噴火獸號:裴列恩之艦

人總是後悔那些沒做的事,而不是做過的事。

Start ssh-agent upon remote SSH login

leave a comment »

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.

作者為pellaeon

一月 28, 2012 於 4:52 下午

張貼於FreeBSD

標籤

發表迴響

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

連結到 %s

Follow

Get every new post delivered to your Inbox.