Tuesday, January 25, 2011

How to ssh/scp/sudo without being prompted for password

As source user run:
ssh-keygen -t rsa
This will geenerate ~/..sh/id_rsa.pub

Copy ~/.ssh/id_rsa.pub to target machine e.g. /tmp/tmpkey

As target user run:
cat /tmp/tmpkey >> ~/.ssh/authorized_keys


Ensure correct permissions

chmod go-w $HOME $HOME/.ssh $HOME/.ssh/authorized_keys