Usually when you log in through GDM/lightDM…, etc, it’ll start ssh-agent for you. But what if I’m logging in from a remote machine through SSH?
After trying a few scripts on the Internet that doesn’t work, I decided to do it myself.
I’m going to set this up in tcsh environment, so this probably won’t work in bash.
~/.login , tcsh will execute commands in this file after login, add
eval `ssh-agent -c`
And that’s it, basically it just set some environment variables.
eval will take its argument as an command and execute it, `ssh-agent -c` means the output of ssh-agent -c , not the string ‘ssh-agent -c’ itself.
-c will “Generate C-shell commands on stdout." as the manpage said.