Simple connection with SSH server
Example: ssh username@domainname.com
Connecting at a specific port
Example: ssh -p port username@domainname.com
Port mapping/Tunneling with SSH
Example: ssh username@domainname.com -L 125:someserver.com:25
Description:
This will map the local port 125 with someserver.com’s port 25. So if
you will specify localhost:125 as your smtp server in your email client
then you will actually using someserver.com’s mail server.
Example: ssh username@192.168.1.77 -L 1110:xx.xx.xx.xx:110 -L 125:xx.xx.xx.xx:25
Description: Multiple port mappings
Secure FTP
First do a port map with ssh
ssh user@servername.com -L 21:servername.com:21
Now use localhost as hostname in your ftp client software.
Uploading with ssh and rsync
Example: rsync -v –rsh=”ssh -l username” /path/to/local/file username@servername.com:/some/folder
Description: It will upload “file” in “folder”
Uploading with ssh
Example: tar cf – /some/local/folder | ssh username@192.168.1.26 ‘(cd public_html;tar xvpf -)’
Description: Trust me! It wil upload “folder” in to p”public_html” of server
Downloading with ssh
Example: ssh username@192.168.1.26 ‘tar cf – /path/to/file’ | tar xvpf -
Description: Yes it will download “file” from server
Private/Public key authentication
On client server run this command.: ssh-keygen -t rsa
Press enter on all options.
This will put your publick key in ~/.ssh/id_rsa.pub
Copy your public key from ~/.ssh/id_rsa.pub and put it on the server in ~/.ssh/authorized_keys
Description: This will let you login to ssh server without providing password each time.
Uploading with scp
Example: scp filename.tar.gz username@192.12.5.6:/some/path
Description: If you have public/private key authentication setup then it will not prompt for a password.
Downloading with scp
Example: scp username@192.12.5.6:/some/path filename.tar.gz
Description: If you have public/private key authentication setup then it will not prompt for a password.
Sign up for our daily email newsletter:
You must log in to post a comment.