Start ssh-agent upon remote SSH login

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.

Open ~/.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.


在下方填入你的資料或按右方圖示以社群網站登入: 標誌

您的留言將使用 帳號。 登出 /  變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )


您的留言將使用 Facebook 帳號。 登出 /  變更 )


連結到 %s