Ssh
From Cheatsheet
login without password
CLIENT ---------> SERVER
on CLIENT generate public key, id_dsa.pub so you can establish a link based on dsa encryption
ssh-keygen -t dsa -f ~/.ssh/id_dsa -C "yourusername@clients_IP_or_hostname.com" cat ~/.ssh/id_dsa.pub | ssh yourusername@servers_IP_or_hostname.com 'cat - >> ~/.ssh/authorized_keys'
now try to login to the server from your client
ssh yourusername@servers_IP_or_hostname.com
you should get a prompt for a passphrase, then it should log you in. Now logout to get back to your client
ssh-agent bash ssh-add
it will ask you for your passphrase, enter it. Now try to login to the remote host, it should let you in with no password
ssh yourusername@servers_IP_or_hostname.com
it should just log you in
keep ssh from logging you out
vi /etc/ssh/sshd_config ClientAliveInterval 1500 apt-get install screen screen (start screen) ctrl-A c (create new screen inside current screen session) ctrl-A n (go to next screen inside screen session) ctrl-A p (go to previous screen inside screen session) ctrl-A K (kill the current session you're in, exit also works) ctrl-A H (log all the stuff you do in screen) screen -ls (shows current screen sessions, example: 31619.ttyp2.gigan) screen -r 31619.ttyp2.gigan (re-attach to screen session) echo $TERM (shows you if this session is inside screen)
you can use
nohup ./scriptname.sh &
to run a script in the background and keep it running if ssh logs you out, but you can't re-attach to that console to see what it's doing, you just have to rely on the log files.
[reference http://www.rackaid.com/resources/linux-tutorials/general-tutorials/using-screen/]
