using SSH

from the gnulinuxclub wiki

|| what is ssh ? || 1 ||

??? SSH is an acronym for Secure SHell, an encrypted connection technology that relies on public key encryptio
n to encrypt your connections to and from machines, including the passwords and usernames || the ssh command i
s a secure replacement for rsh and rlogin while the scp command is a secure replacement for rcp ||

??? ssh, like many services, consists of two parts: clients and servers || the “client” is a program executed
by you to connect to another machine and the “server” is the program that is constantly running and answers co
nnection requests from another machine || i substitute the word “client” with “home” for easy understanding wh
ich just means your machine, but check for the path (/home/login/….) always ||

|| generating the ssh key || 2 ||

??? first, you need to have an ssh account with a server || after that, you can generate a “key”, so in a cons
ole/terminal type
??? $ ssh-keygen -t dsa
??? and assign a passphrase for it (remember it)
??? or
??? $ ssh-keygen -t rsa
??? and assign a passphrase for it (remember it)

??? public and private keys will be generated and are “hidden” files stored in /home/username ||

??? the file is a hidden file (has a dot(.) infront of file name) and is your public key used for a
uthentication with the server while the private key must not be sent to others ||

|| sending files from home to server || 3 ||

??? now that you have an ssh account with a server you may want to send files from home to the remote server,
say dir/foo.html to (your ssh login), then open a new terminal and type :

??? $ scp dir/foo.html

? and it will ask for the password and transmit the file ||
??? remember : you don’t need to be logged in with ssh to use scp as it starts a new ssh session to copy the f
iles every time you use scp so it asked you for the password ||
??? after the file is transmitted it will show “100%” in the terminal, and if no succesful transmission has ta
ken place it gives and error like this :

??? ssh: Temporary failure in name resolution
??? lost connection
??? [if you see the above message, it means you are not connected to the internet so check that first]

note : “login” is your loginID or name assigned to you
|| copying files from server to home || 4 ||

??? to copy files securely from your home directory on the server to home (PC), open a new terminal and type :

??? $ scp .

??? the “.” is the destination (the current directory), it’s important so don’t leave it off ||

??? some more examples :

??? $ scp
myfile.old.html {#to copy your myfile.html from the server to
myfile.old.html at home (PC)}

$ scp ‘*.html’ . {#to copy all .html files in
~loginID/myfolder/ (/var/myfolder/loginID) from the server to home (PC)}

Leave a Reply

Your email address will not be published. Required fields are marked *