Ssh-agent works, ssh-add doesn't

I have added both new and old pub keys to authourized_keys on the router.
I can't seem to get the new key to add in garuda. I have forgotten how I added the last one.

 ╰─λ   ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-XXXXXXl8HN8c/agent.3432; export SSH_AUTH_SOCK;
SSH_AGENT_PID=3433; export SSH_AGENT_PID;
echo Agent pid 3433;

 ╭─[email protected] in ~ took 3ms
 ╰─λ   ssh-add -l
Error connecting to agent: No such file or directory

eval "$(ssh-agent)"
fish: Unsupported use of '='. In fish, please use 'set SSH_AUTH_SOCK /tmp/ssh-XXXXXXjzeZQb/agent.4713'.

eval $(ssh-agent)
fish: Unsupported use of '='. In fish, please use 'set SSH_AUTH_SOCK /tmp/ssh-XXXXXXjzeZQb/agent.4713'.

ls
.rw-------  748 jeremy  8 May 11:06  router
.rw-r--r--  275 jeremy  8 May 11:06  router.pub

 ╭─[email protected] in ~/.ssh took 6ms
[🔴] × ssh-add router
Error connecting to agent: No such file or directory

I found this thread and have gone trough it. In this link there is a fish_ssh_agent that will allow me to get ssh-add -l to work. My github keys are not listed only the new key and the new key will still work even after reboot. Any assistance would be great.

garuda-inxi
garuda-inxi
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_ADDRESS = "en_CA.UTF-8",
	LC_NAME = "en_CA.UTF-8",
	LC_MONETARY = "en_CA.UTF-8",
	LC_PAPER = "en_CA.UTF-8",
	LC_IDENTIFICATION = "en_CA.UTF-8",
	LC_TELEPHONE = "en_CA.UTF-8",
	LC_MEASUREMENT = "en_CA.UTF-8",
	LC_TIME = "en_CA.UTF-8",
	LC_NUMERIC = "en_CA.UTF-8",
	LANG = "en_CA.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
System:
  Kernel: 5.17.4-2-cacule arch: x86_64 bits: 64 compiler: gcc v: 11.2.0
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-cacule
    root=UUID=00b33177-335b-466d-8a5b-e5bad5669f19 rw [email protected]
    quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
    systemd.unified_cgroup_hierarchy=1 loglevel=3
  Desktop: KDE Plasma v: 5.24.5 tk: Qt v: 5.15.3 info: latte-dock
    wm: kwin_x11 vt: 1 dm: SDDM Distro: Garuda Linux base: Arch Linux
Machine:
  Type: Laptop System: Micro-Star product: GL65 9SE v: REV:1.0
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: Micro-Star model: MS-16U5 v: REV:1.0 serial: <superuser required>
    UEFI: American Megatrends v: E16U5IMS.102 date: 03/17/2020
Battery:
  ID-1: BAT1 charge: 24.7 Wh (60.1%) condition: 41.1/51.6 Wh (79.7%)
    volts: 11.1 min: 10.9 model: MSI BIF0_9 type: Li-ion serial: N/A
    status: N/A
CPU:
  Info: model: Intel Core i7-9750H bits: 64 type: MT MCP arch: Coffee Lake
    family: 6 model-id: 0x9E (158) stepping: 0xA (10) microcode: 0xEC
  Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
    L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 1.5 MiB desc: 6x256 KiB
    L3: 12 MiB desc: 1x12 MiB
  Speed (MHz): avg: 800 min/max: 800/4500 scaling: driver: intel_pstate
    governor: powersave cores: 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800
    8: 800 9: 800 10: 800 11: 800 12: 800 bogomips: 62469
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf
    mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: spec_store_bypass
    mitigation: Speculative Store Bypass disabled via prctl
  Type: spectre_v1
    mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW,
    STIBP: conditional, RSB filling
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel CoffeeLake-H GT2 [UHD Graphics 630] vendor: Micro-Star MSI
    driver: i915 v: kernel ports: active: eDP-1 empty: none bus-ID: 00:02.0
    chip-ID: 8086:3e9b class-ID: 0300
  Device-2: NVIDIA TU106M [GeForce RTX 2060 Mobile] vendor: Micro-Star MSI
    driver: nvidia v: 510.68.02 alternate: nouveau,nvidia_drm pcie: gen: 1
    speed: 2.5 GT/s lanes: 16 link-max: gen: 3 speed: 8 GT/s bus-ID: 01:00.0
    chip-ID: 10de:1f11 class-ID: 0300
  Device-3: Chicony HD Webcam type: USB driver: uvcvideo bus-ID: 1-13:5
    chip-ID: 04f2:b695 class-ID: 0e02
  Display: x11 server: X.Org v: 21.1.3 with: Xwayland v: 22.1.1
    compositor: kwin_x11 driver: X: loaded: intel,nvidia
    unloaded: modesetting,nouveau alternate: fbdev,nv,vesa gpu: i915
    display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
    s-diag: 582mm (22.93")
  Monitor-1: eDP-1 mapped: eDP1 model: AU Optronics 0xd0ed built: 2019
    res: 1920x1080 hz: 120 dpi: 143 gamma: 1.2 size: 340x190mm (13.39x7.48")
    diag: 394mm (15.5") ratio: 16:9 modes: 1920x1080
  OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2)
    v: 4.6 Mesa 22.0.3 direct render: Yes
Audio:
  Device-1: Intel Cannon Lake PCH cAVS vendor: Micro-Star MSI
    driver: snd_hda_intel v: kernel
    alternate: snd_soc_skl,snd_sof_pci_intel_cnl bus-ID: 00:1f.3
    chip-ID: 8086:a348 class-ID: 0403
  Sound Server-1: ALSA v: k5.17.4-2-cacule running: yes
  Sound Server-2: PulseAudio v: 15.0 running: no
  Sound Server-3: PipeWire v: 0.3.51 running: yes
Network:
  Device-1: Intel Cannon Lake PCH CNVi WiFi driver: iwlwifi v: kernel
    bus-ID: 00:14.3 chip-ID: 8086:a370 class-ID: 0280
  IF: wlo1 state: up mac: <filter>
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Micro-Star MSI driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 port: 3000 bus-ID: 03:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp3s0 state: down mac: <filter>
  IF-ID-1: virbr0 state: down mac: <filter>
Bluetooth:
  Device-1: Intel Bluetooth 9460/9560 Jefferson Peak (JfP) type: USB
    driver: btusb v: 0.8 bus-ID: 1-14:6 chip-ID: 8087:0aaa class-ID: e001
  Report: bt-adapter ID: hci0 rfk-id: 0 state: down
    bt-service: enabled,running rfk-block: hardware: no software: no
    address: <filter>
Drives:
  Local Storage: total: 1.38 TiB used: 561.07 GiB (39.8%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital
    model: PC SN520 SDAPNUW-512G-1032 size: 476.94 GiB block-size:
    physical: 512 B logical: 512 B speed: 15.8 Gb/s lanes: 2 type: SSD
    serial: <filter> rev: 20140000 temp: 46.9 C scheme: GPT
  ID-2: /dev/sda maj-min: 8:0 vendor: Western Digital
    model: WD10JPVX-60JC3T0 size: 931.51 GiB block-size: physical: 4096 B
    logical: 512 B speed: 6.0 Gb/s type: HDD rpm: 5400 serial: <filter>
    rev: 1A01 scheme: GPT
Partition:
  ID-1: / raw-size: 146.48 GiB size: 146.48 GiB (100.00%)
    used: 66.05 GiB (45.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-2: /boot/efi raw-size: 256 MiB size: 252 MiB (98.46%)
    used: 557 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 146.48 GiB size: 146.48 GiB (100.00%)
    used: 66.05 GiB (45.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-4: /var/log raw-size: 146.48 GiB size: 146.48 GiB (100.00%)
    used: 66.05 GiB (45.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-5: /var/tmp raw-size: 146.48 GiB size: 146.48 GiB (100.00%)
    used: 66.05 GiB (45.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: zram size: 15.47 GiB used: 0 KiB (0.0%) priority: 100
    dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 53.0 C pch: 58.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Info:
  Processes: 397 Uptime: 2m wakeups: 1 Memory: 15.47 GiB
  used: 3.08 GiB (19.9%) Init: systemd v: 250 tool: systemctl Compilers:
  gcc: 11.2.0 clang: 13.0.1 Packages: pacman: 1844 lib: 552 Shell: fish
  v: 3.4.1 running-in: alacritty inxi: 3.3.15
Garuda (2.6.2-1):
  System install date:     2022-01-25
  Last full system update: 2022-05-08
  Is partially upgraded:   No
  Relevant software:       NetworkManager
  Windows dual boot:       No/Undetected
  Snapshots:               Snapper
  Failed units:            systemd-oomd.socket
cat ~/.config/fish/conf.d/ssh.fish

alias addssh='eval (ssh-agent -c) && ssh-add ~/.ssh/$1'
alias lssshagent='eval (ssh-agent -c) && ssh-add -L'
alias delssh='eval (ssh-agent -c) && ssh-add -D'

addssh router works
lsssshagent does not list any identities.

lssshagent
The agent has no identities.

I can now log into the router with keys. So I guess this is a win?

A few folks have been hacking around on a tiny script to help run ssh-agent with fish here: Run ssh-agent via fish shell · GitHub

I can't really tell from reading the script if it will help in your case or not, but I thought I would drop it in the thread anyhow just in case.

1 Like

Thanks, Have you tried any of those scripts. The long one listed there looks very interesting.

I have not tried any of them out actually--so far all of my horsing around with ssh has been in bash.

It seems like that guy wrote the long one to enable running multiple agents. Unless that is something you need, I would probably try this one:

# config.fish
if not pgrep --full ssh-agent | string collect > /dev/null
  eval (ssh-agent -c)
  set -Ux SSH_AGENT_PID $SSH_AGENT_PID
  set -Ux SSH_AUTH_SOCK $SSH_AUTH_SOCK
end
3 Likes

I added this to ~/.fish_profile so that if the config for fish is updated this will still run.

ssh-add -L
The agent has no identities.

The good it connects to an ssh-agent. The bad is it still lists no identities after a reboot. I have added another key and can successfully connect to the router.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.