How to disable ssh-agent autostart?


as part of my session a ssh-agent is being started. As I am using keychain instead, I don’t want this because it messes-up my env variables and prevents my keychain user unit to surface.

I see that it is running as part of the session: sudo ps -o pid,unit,lstart -p $SSH_AGENT_PID:

    PID UNIT                                             STARTED
  35607 session-12.scope                Sun Nov  7 16:46:15 2021

But I cannot find where it is being started. I checked everywhere: systemd, systemd --user, .bashrc, .xinitrc, .profile, .config/autostart

I also literally searched my whole drive for any files that actual do the ssh-agent -s call.

I honestly have no idea where to look.

Best Regards, Felix

grep -r 'ssh-agent' $HOME
grep -r 'ssh-agent' /etc/

Thanks for idea. Already did that. Just did it again with the suggested commands, no results beyond obvious stuff like history and clipman.

No autostart:

sudo systemctl disable sshd.service

…or diable complete:

sudo systemctl mask sshd.service

Hi, thanks for the idea. However the package/service is not installed: Unit ssh.service could not be found.

systemctl list-unit-files | grep -Ei 'ssh|agent'

what is output of:

systemctl status avahi-daemon


systemctl status sshd


$ sudo systemctl list-unit-files | grep -Ei 'ssh|agent'
qemu-guest-agent.service                                                      disabled        disabled
spice-vdagentd.service                                                        indirect        disabled
sshd.service                                                                  disabled        disabled
sshdgenkeys.service                                                           static          -
spice-vdagentd.socket                                                         static          -

$ sudo systemctl status avahi-daemon
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
     Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: disabled)
     Active: active (running) since Sun 2021-11-07 17:18:51 CET; 24min ago
TriggeredBy: ● avahi-daemon.socket
   Main PID: 382 (avahi-daemon)
     Status: "avahi-daemon 0.8 starting up."
      Tasks: 2 (limit: 11702)
     Memory: 2.0M
        CPU: 115ms
     CGroup: /system.slice/avahi-daemon.service
             ├─382 "avahi-daemon: running [############.local]"
             └─392 "avahi-daemon: chroot helper"

###### removed logs ########


$ sudo systemctl status ssh
Unit ssh.service could not be found.

I edited my post to sshd.service. Arch Wiki says:

Start/enable sshd.service. It will keep the SSH daemon permanently active and fork for each incoming connection.[1].

Note: openssh 8.0p1-3 removed sshd.socket that used systemd's socket activation due to it being susceptible to denial of service. See FS#62248 for details. If sshd.socket is enabled when updating to openssh 8.0p1-3, the sshd.socket and sshd@.service units will be copied to /etc/systemd/system/ and reenabled. This is only done to not break existing setups, users are still advised to migrate to sshd.service.

Check for something with gnome-keyring in your users autostart directory. (gnome keyring contains an ssh agent)

Hi, thanks for taking the time. I checked this already. I also (temporarily) disabled all autostarts to ensure it’s not being started as part of a component I don’t know. This did not help, though. 🤷

I just started the XFCE-edition installation ISO and it has the same issue. The KDE-edition does not show this behavior.

Okay, found the solution:

xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled -n -t bool -s false
xfconf-query -c xfce4-session -p /startup/gpg-agent/enabled -n -t bool -s false

google “xfce4-session - Advanced Topics”

Unfortunately this still prevents the required variables to be passed trough. google “Allowing xfce4-session to use external ssh-agent”

Currently , there is no way to get this running with XFCE. I switch to KDE to work around this. (Also for its better HiDPI scaling support.)

Thanks everybody who invested their time.

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