Problem with my ssh session

HI,

I’M from linux mint and pop OS, and usualy to open my ssh session without having to add everytimes my passphrase, I always use a script in bashrc, so when I start a new session I just have to enter one my pass, but with garuda, when I open the session with konsole, I don’t receive the passphrase asking, do you know why? Maybe I have to do something else with garuda?
thanks

here the script:

if [ ! -S ~/.ssh/ssh_auth_sock ]; then
  eval `ssh-agent`
  ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
fi
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
ssh-add -l > /dev/null || ssh-add

garuda-inxi
System:
Kernel: 6.5.9-zen2-1-zen arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
clocksource: tsc available: hpet,acpi_pm
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=73c23039-fcbf-4985-9c10-a4426ad13bb9 rw rootflags=subvol=@
quiet loglevel=3 ibt=off
Desktop: KDE Plasma v: 5.27.10 tk: Qt v: 5.15.12 wm: kwin_wayland vt: 1
dm: SDDM Distro: Garuda Linux base: Arch Linux
Machine:
Type: Desktop System: Micro-Star product: MS-7B79 v: 3.0
serial: <superuser required>
Mobo: Micro-Star model: X470 GAMING PLUS MAX (MS-7B79) v: 3.0
serial: <superuser required> UEFI: American Megatrends LLC. v: H.G0
date: 07/27/2022
Battery:
Device-1: hidpp_battery_0 model: Logitech Wireless Keyboard K360
serial: <filter> charge: 100% (should be ignored) rechargeable: yes
status: discharging
Device-2: hidpp_battery_1 model: Logitech Wireless Mouse M325
serial: <filter> charge: 55% (should be ignored) rechargeable: yes
status: discharging
CPU:
Info: model: AMD Ryzen 7 1700 bits: 64 type: MT MCP arch: Zen level: v3
note: check built: 2017-19 process: GF 14nm family: 0x17 (23) model-id: 1
stepping: 1 microcode: 0x8001138
Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
L1: 768 KiB desc: d-8x32 KiB; i-8x64 KiB L2: 4 MiB desc: 8x512 KiB
L3: 16 MiB desc: 2x8 MiB
Speed (MHz): avg: 1731 high: 3198 min/max: 1550/3000 boost: enabled
scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 3198 2: 1422
3: 1550 4: 1418 5: 1550 6: 1550 7: 1550 8: 1550 9: 3188 10: 1550 11: 1421
12: 1550 13: 1550 14: 1550 15: 1550 16: 1550 bogomips: 95999
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Vulnerabilities: <filter>
Graphics:
Device-1: NVIDIA GF108 [GeForce GT 630] vendor: ZOTAC driver: nouveau
v: kernel non-free: series: 390.xx+ status: legacy (EOL~2022-11-22) last:
release: 390.157 kernel: 6.0 xorg: 1.21 arch: Fermi code: GF1xx
process: 40/28nm built: 2010-2016 pcie: gen: 1 speed: 2.5 GT/s lanes: 16
ports: active: HDMI-A-1 empty: DVI-I-1,DVI-I-2 bus-ID: 27:00.0
chip-ID: 10de:0f00 class-ID: 0300 temp: 31.0 C
Display: wayland server: X.org v: 1.21.1.11 with: Xwayland v: 23.2.4
compositor: kwin_wayland driver: X: loaded: nouveau unloaded: modesetting
alternate: fbdev,nv,vesa dri: nouveau gpu: nouveau display-ID: 0
Monitor-1: HDMI-A-1 res: 1920x1080 size: N/A modes: N/A
API: EGL v: 1.5 hw: drv: nvidia nouveau platforms: device: 0 drv: nouveau
device: 1 drv: swrast gbm: drv: nouveau surfaceless: drv: nouveau wayland:
drv: nouveau x11: drv: nouveau
API: OpenGL v: 4.5 compat-v: 4.3 vendor: mesa v: 23.3.4-arch1.2 glx-v: 1.4
direct-render: yes renderer: NVC1 device-ID: 10de:0f00 memory: 1.94 GiB
unified: no display-ID: :1.0
API: Vulkan v: 1.3.276 layers: 3 device: 0 type: cpu name: llvmpipe (LLVM
16.0.6 256 bits) driver: mesa llvmpipe v: 23.3.4-arch1.2 (LLVM 16.0.6)
device-ID: 10005:0000 surfaces: xcb,xlib,wayland
Audio:
Device-1: NVIDIA GF108 High Definition Audio vendor: ZOTAC
driver: snd_hda_intel v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 16
bus-ID: 27:00.1 chip-ID: 10de:0bea class-ID: 0403
Device-2: AMD Family 17h HD Audio vendor: Micro-Star MSI
driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
bus-ID: 29:00.3 chip-ID: 1022:1457 class-ID: 0403
API: ALSA v: k6.5.9-zen2-1-zen status: kernel-api tools: N/A
Server-1: PipeWire v: 1.0.1 status: active with: 1: pipewire-pulse
status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
Device-1: 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: f000 bus-ID: 22:00.0 chip-ID: 10ec:8168 class-ID: 0200
IF: enp34s0 state: down mac: <filter>
Device-2: Intel Wireless 7265 driver: iwlwifi v: kernel pcie: gen: 1
speed: 2.5 GT/s lanes: 1 bus-ID: 23:00.0 chip-ID: 8086:095a class-ID: 0280
IF: wlp35s0 state: up mac: <filter>
Bluetooth:
Device-1: Intel Bluetooth wireless interface driver: btusb v: 0.8 type: USB
rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-9:2 chip-ID: 8087:0a2a
class-ID: e001
Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 4.2
lmp-v: 8 status: discoverable: no pairing: no class-ID: 7c0104
Drives:
Local Storage: total: 698.65 GiB used: 216.51 GiB (31.0%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung
model: SSD 970 EVO Plus 250GB size: 232.89 GiB block-size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
fw-rev: 2B2QEXM7 temp: 28.9 C scheme: GPT
ID-2: /dev/sda maj-min: 8:0 vendor: Western Digital
model: WDS500G2B0A-00SM50 size: 465.76 GiB block-size: physical: 512 B
logical: 512 B speed: 6.0 Gb/s tech: SSD serial: <filter> fw-rev: 20WD
scheme: MBR
Partition:
ID-1: / raw-size: 232.59 GiB size: 232.59 GiB (100.00%)
used: 9.95 GiB (4.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
used: 584 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 232.59 GiB size: 232.59 GiB (100.00%)
used: 9.95 GiB (4.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-4: /var/log raw-size: 232.59 GiB size: 232.59 GiB (100.00%)
used: 9.95 GiB (4.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-5: /var/tmp raw-size: 232.59 GiB size: 232.59 GiB (100.00%)
used: 9.95 GiB (4.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
ID-1: swap-1 type: zram size: 15.54 GiB used: 31.2 MiB (0.2%)
priority: 100 comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 16
dev: /dev/zram0
Sensors:
System Temperatures: cpu: 28.1 C mobo: N/A gpu: nouveau temp: 31.0 C
Fan Speeds (rpm): N/A
Info:
Processes: 371 Uptime: 5h 1m wakeups: 0 Memory: total: 16 GiB
available: 15.54 GiB used: 4.64 GiB (29.8%) Init: systemd v: 255
default: graphical tool: systemctl Compilers: gcc: 13.2.1 Packages:
pm: pacman pkgs: 1229 libs: 356 tools: octopi,paru,yay Shell: fish v: 3.7.0
running-in: konsole inxi: 3.3.31
Garuda (2.6.22-1):
System install date:     2024-02-01
Last full system update: 2024-02-01 ↻
Is partially upgraded:   No
Relevant software:       snapper NetworkManager dracut
Windows dual boot:       No/Undetected
Failed units:            [email protected]
1 Like

What’s the problem with not posting garuda-inxi?
It contains additional, useful information about the status of your system.

:warning: Missing information requested in the template may result in not receiving assistance

Make sure you have done the following before you post:

Issue still unresolved? Then:

  • ONE issue per topic.

  • Describe your issue in detail. The more we know, the better we can help

  • Show us the results of your searches, and what you’ve tried

  • After rebooting, post the FULL output of garuda-inxi in the body of the post (not linked externally, or collapsed with the “hide details” feature)

  • Format terminal output (including your garuda-inxi) as a code block by clicking the preformatted text button (</>) , or put three tildes (~) above and below the text

Without garuda-inxi this request will be moved to 412 Precondition Failed

3 Likes

here we go, sorry

Most likely not the root cause of your problem, but that symbol means that a reboot is pending after an update.

After that, you should probably investigate this

Additionally, rather than bashrc, I think you should use config.fish, because fish is the shell we use here by default.
I can’t help you much here, but give a look at this hint and, if necessary, the linked Arch wiki article.

1 Like

What you are setting up is ssh agent and making it share a single session so that other terminals can use it as well. The only problem is you are setting it up for bash and garuda by default uses fish.

Go to,

~/.config/fish/config.fish

Put this at the end of file

if ! pgrep -u "$USER" ssh-agent > /dev/null;
    ssh-agent -c -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env"
end
if [ ! -f "$SSH_AUTH_SOCK" ];
    source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
end

Save it exit it and open a new terminal.

Please note the -t 1h ensures that ssh agent only holds identities for a max time of 1h i.e. you would be asked to enter password again after an hour has passed. I do this for better security you can remove this flag if you want.

In new terminal type

ssh-add

This will prompt you to enter password for the ssh id you have created and add it to ssh-agent. Once done ssh session’s won’t request passwords unless the ssh-agent expires (due to -t flag) or you reboot.

You can

ssh-add -l

To see the identites ssh-agent currently has.

To read more,
https://wiki.archlinux.org/title/SSH_keys#SSH_agents

3 Likes

thank you very much, but ssh-add does not work, my script was about .ssh with my id_ed25519 key, but I guess I need to copy that to .config/fish ?

ssh-add
Could not open a connection to your authentication agent.

I added in config.fish

## Run fastfetch if session is interactive
if status --is-interactive && type -q fastfetch
fastfetch --load-config dr460nized
end

if ! pgrep -u "$USER" ssh-agent > /dev/null;
ssh-agent -c -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env"
end
if [ ! -f "$SSH_AUTH_SOCK" ];
source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
end

do you know what it could be?

Did you open a new terminal after adding that to config.fish? Because it says ssh-agent is not available.

It’s your system. Help yourself.

Either of

systemctl status [email protected]

Or

journalctl --grep [email protected]

Would show you what’s going on.

1 Like

yes, but seems to work now after reboot

OpenSSH includes a user service that takes care of this for you. You just need to set the SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" environment variable somewhere (in ~/.profile is fine) and enable the service.

systemctl --user enable --now ssh-agent.service

https://wiki.archlinux.org/title/SSH_keys#Start_ssh-agent_with_systemd_user

5 Likes

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