SSH and SCP

Setting Up Passwordless Connection

Secure Copy or SCP is a means of securely transferring computer files between a local and a remote host or between two remote hosts, using the Secure Shell (SSH) protocol.

The term SCP can refer to one of two related things, the SCP protocol or the SCP program.

*** use password less only if needed , making life easier then it needs to be has adverse consequences …
hosta/hostb

$ /usr/bin/ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_rsa.
Your public key has been saved in /export/home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
3e:89:0c:44:5c:09:e9:07:98:cc:6a:35:35:17:3d:dd oracle@wdlilnxsusrs01

cat id_rsa.pub >> user@hostb:~/.ssh/authorized_keys

Now you can ssh/scp from host A to host B do the same on host B to allow both servers only if needed that host B connects to host A without password.

 

Using SCP to copy Files

If user dvader is on a computer called empire.gov, and wants to copy a file called file1.txt to a directory called somedir in his account on a computer called deathstar.com, he would enter:

scp file1.txt dvader@deathstar.com:somedir

Likewise, if he wanted to copy the entire contents of the somedir directory on deathstar.com back to his empire.gov account, he would enter:

scp -r dvader@deathstar.com:somedir somedir

Similarly, if he is working on another computer, but wanted to copy a file called file1.txt from his home directory on empire.gov to a directory called somedir in his account on deathstar.com, he would enter:

scp dvader@empire.gov:file1.txt dvader@deathstar.com:somedir

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: