Youry's Blog

Youry's Blog

Auto SSH Login without Password

leave a comment »

1. ssh tuneling

2. How to check tunnel:

Not everything work in Fedora, but this one works very good, at least in the Fedora 13. Good paper
Steps 1: At the Host Machine
1. Logon to the root home directory.
2. Make sure the hidden .ssh directory has the permission 700. If not execute the command
chmod 700 .ssh
3. Change Directory to .ssh directory by executing the command
cd .ssh
4. Generate the public-private keys using the ssh-keygen command.
# ssh-keygen -t rsa
5. The resulting file id_rsa and rsa type public key
# ssh-copy-id -i ~/.ssh/ remote-host -> Copy the public key to the remote server:

scp ~/.ssh/
mkdir ~/.ssh
chmod 700 .ssh
cat pubkey.txt >> ~/.ssh/authorized_keys
rm ~/pubkey.txt
chmod 600 ~/.ssh/*

See more here:

Some extra steps should be done:
Start the ssh-agent:
eval `ssh-agent`
ssh-add #Add your private key to the agent’s cache:

Test the connection again

Setup an automated start-agent script:
First, click here for his sssha script. It is a BASH shell script, so if you use a different login shell, you will have to modify it. Once you download it, place it in your ~/.ssh/ directory and add this to your ~/.bashrc configuration script, presumably at or near the end:

# setup ssh-agent, if appropriate
if [ -f “$HOME/.ssh/sssha” ]; then
source $HOME/.ssh/sssha

Finally, if you are truly paranoid, make sure to kill your ssh-agent when you are done using any machine on which you have started one. This can be accomplished most simply with ssh-agent -k.

Note: I personally prefer to add an alias to the .bashhrc profile:
alias ssha=’eval \`ssh-agent\`; ssh-add’

and run it manually when I need it.


Written by youryblog

November 19, 2010 at 10:29 AM

Leave a Reply

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

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

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

Facebook photo

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


Connecting to %s

%d bloggers like this: