/*******************************************************/ ssh secure shell /* */ runs on port 22 presentation at Linux Meetup Tue 18 Nov 2008 06:09:42 PM CST by Bob Carnaghi http://linux.meetup.com/85/ http://www.webpointmorpheus.com /*******************************************************/ GENERAL SSH CONNECTIONS ssh www.webserver.com ssh 12.34.56.78 will login as current user on client machine and prompt for password ssh any_user@www.webserver.com ssh any_user@12.34.56.78 will prompt for password /*******************************************************/ SSH CONNECTION WITHOUT PASSWORD PROMPT assumed: logging in to computer2 as user2 from computer1 (user1) 1. create an authentication key while logged in to computer1: $ ssh-keygen -t dsa (accept the default location for saving the key - press ENTER) (do not create a passphrase, press ENTER) (the key will be saved in the user1/.ssh folder) (check that folder for an id_dsa.pub - public - key) 2. transfer the PUBLIC key to computer2 $ ssh-copy-id -i ~/.ssh/id_dsa.pub user2@computer2 3. login from user1@computer1: ssh user2@computer2 (should not be prompted for password) /*******************************************************/ SFTP ftp over the ssh channel sftp user2@computer2 /* */ COMMANDS cd change directory on the remote machine exit, quit exit the connection get copy the specified file to the local machine help get help on commands lcd change directories on the local machine lls list files on the local machine ls list files on the remote machine put send a file to the remote machine rm delete (remove) file from the remote machine /*******************************************************/ BACKUP (TAR) OVER SSH tar cvzf - /directory-on-local-machine | ssh user2@computer2 "cat > backup.tgz" /*******************************************************/ forward X11 over ssh -- on the remote machine, in the sshd_config file, X11Forwarding = yes ssh -X remote_machine (will ssh into the remote machine, X traffic will be passed on the connection) (on local machine) xeyes & (xeyes will be displayed on local desktop, but comes from remote machine) /*******************************************************/ RSYNC OVER SSH rsync -ave ssh user2@computer2:directory2/ /computer1/directory1/ /*******************************************************/ REFERENCES SSH, The Secure Shell: The Definitive Guide [ILLUSTRATED] (Paperback) Publisher: O'Reilly Media, Inc.; 2 edition (May 10, 2005) ISBN-10: 0596008953 http://www.openssh.com/ - open source http://www.ssh.com/ - commercial http://www.employees.org/~satch/ssh/faq/ - ssh faq, lots of info /*******************************************************/