These are just some most common command for dealing with ssh in Linux.
First, let’s make sure we have ssh (in Ubuntu and most all linux distribution it should be already included):
If we get something like this, it is fine
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-i identity_file] [-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-w local_tun[:remote_tun]] [user@]hostname [command]
Now, if I want to copy my file test.txt present in my home folder on server in the pippo directory where i know the credentials of user
elect@elect-laptop:~$ scp test.txt user@server:/pippo
Note: server can be also an IP address
If it is the first time, I will be asked something like
The authenticity of host ‘server (012.345.678.901)’ can’t be established.
RSA key fingerprint is z6:32:07:6e:05:45:45:07:0e:01:2a:ca:0b:5b:b7:fg.
Are you sure you want to continue connecting (yes/no)?
Just time yes and continue
Then it is time for the password
Type it, and this is the result:
elect@elect-laptop:~$ scp text.txt user@server:/pippo
test.txt 100% 756KB 755.9KB/s 00:00
To transfer an entire directory
elect@elect-laptop:~$ scp -r directory user@server:/pippo
The other way round for keep text.txt in my home directory….
elect@elect-laptop:~$ scp user@server:/pippo/text.txt .
Ps: note the dot “.” at the end
….. or a directory
elect@elect-laptop:~$ scp -r user@server:/pippo/directory .
if you want to move all files, the traditional asterisked ” * ” is always valid 🙂