
SEE: 20 quick tips to make Linux networking easier (free PDF) (TechRepublic) Added security and easeĪnd that, my friends, is how you make use of ssh key authentication with the scp command. When you’re done with the session, make sure to issue the command kill PID (Where PID is the actual number given to you when you started the ssh-agent session with eval). Add your ssh key to the session with the command ssh-add.Make note of the Process ID (PID) you are given when the session starts.Before issuing the scp command issue eval `ssh-agent` to start the session.The one caveat to this is that you must remember the PID of the agent session and kill it when you’re done.
SSH KEY COPY TO SERVER PASSWORD
What this will do is keep you from having to type that ssh key password every time you issue the scp command. That’s right, using the combination of scp, ssh key authentication, and ssh-agent works really well. You can make this slightly more efficient by using the ssh-agent and ssh-add commands. Sure you could tar them all up into one bigger file, but say they need to all be placed in different directories. Let’s say you are about to undergo a long session of copying files to your server. Scp -i ~/.ssh/id_rsa.pub /home/USER/FILENAMEĪgain, you will be asked for your ssh key password and the file will be pulled from the server and copied to the local machine. The same holds true if you need to pull a file from the remote server. Once authenticated, the file will be transferred. You should be prompted for the ssh key password (not the user password). Scp -i ~/.ssh/id_rsa.pub FILENAME FILENAME is the name of the file, USER is the username on the remote machine, and SERVER is the address of the remote server.

The command to send a file to your remote server, using your ssh key, is (assuming you accepted the default name for your ssh key upon creation): Now that our keys are in all the right places, let’s see how we can make use of them, through scp.
SSH KEY COPY TO SERVER PRO
SEE: Securing Linux policy (Tech Pro Research) Using scp with your key Once you successfully authenticate, the public key will be copied to the server. You will be prompted for the remote user password. Ssh-copy-id USER is the username on the remote server and SERVER is the address of the remote server. The next step is to copy the key to the remote server. Once the key’s randomart prints, your key is ready to go. You will be asked to name the file (use the default) and give the keypair a passphrase ( Figure A).

To do this, open up a terminal window and issue the command: The first thing that must be done is the creation of an ssh key pair. I will be demonstrating on an Elementary OS client and Ubuntu 16.04.1 server and will assume you have secure shell installed and working.

I want to show you how you can make use of secure key authentication, along with scp, so you can rest assured your files are being moved back and forth securely. However, with the help of ssh key authentication, you can make that even more secure. With the scp command, you can copy files to and from a remote Linux server, through an encrypted ssh tunnel. That’s where secure copy comes into play. It would also become quite a bit harder to move files back and forth, at least with a modicum of security. Without this tool it would be quite a challenge to remotely administer those servers. Anyone that administers Linux machines knows secure shell well.
