[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: SSH with no passphrase needed

On Thu, Jan 02, 2003 at 02:02:31PM -0800, Ryan Lovett wrote:

:Or 'exec ssh-agent bash' to get rid of the usually useless parent shell.

Or if you want to be cool like me automate teh whole thing in your
.profile :)

---start .bash_profile---

# .bash_profile

#Always run ssh agent
if [ ! $SSH_AGENT_PID ]
    then exec ssh-agent bash --login

#test for keys
#this lists the authenticated keys and sets a variable whose name is
#the key type (RSA1 || RSA2 || DSA) to true if the key is
#already authenticated

for i in `ssh-add -l|awk '{print $4}'|perl -p -e 's/\(//;s/\)//;'`
  do declare $i=true

#authenticate RSA1 and DSA if not already done, make sure the keyfile
#name is correct.

if [ ! $RSA1 ];then ssh-add ~/.ssh/id_rsa1;fi
if [ ! $DSA ];then ssh-add ~/.ssh/id_dsa;fi

source ~/.bashrc

---end .bash_profile---

obvioulsy this could be simpler if you only deal with one key...


Reply to: