September 30, 2019 - 2 min

Secure Shell Connection — SSH and Secure Copy — SCP


				
				

Tibor Kasas

Quality Assurance Engineer

Secure Shell connection, or shortly SSH, is a cryptographic network protocol. It is used for operating network services over an unsecured network. Connecting via SSH is typically done with a remote command-line, login, and remote command execution. Complementary to SSH we have SCP which is a secure way of transferring files between two remote hosts, a local host, and a remote host or vice versa.


SSH provides a secure channel over an unsecured network. This is done by connecting to an SSH server via an SSH client. An interesting thing for SSH connections is that the standard TCP port for them is port 22. First of all, you need to install OpenSSH to the devices you will use for the connection. On Arch-like Linux distributions this is done by running this command in the Terminal:





sudo pacman -S openssh




Doing that you are ready to connect. To connect to a device you will need to find out its IP address. You can do that by executing the following commands from the Terminal.





ifconfig




or





ip address




tibor-slika-1.png
View of ifconfig command from the Terminal

After finding out the IP address of the device that we want to connect to we will have to run the command and enter the password of the user on the device you are connecting to: ssh username@ipaddress -p portnumber


tibor2.png
View of ssh and exit command from the Terminal

Now we are going to copy one file from the local host to the remote host. We are going to do that by executing the following command in the Terminal:



scp -P portnumber /destination/of/local/file.fileextension username@ipaddress:destination/of/remote/file.fileextension


tibor3.png
View of scp command from the Terminal

And here we have again used SSH to login to the remote host and check if the file transfer was actually successful.


Tibor4.png
View of files on the remote host desktop

The main dierence between SSH and SCP is that SSH is used for logging into remote systems and for controlling those systems while SCP is used for transferring files among remote computers in a network.


Give Kudos by sharing the post!

Share:

ABOUT AUTHOR

Tibor Kasas

Quality Assurance Engineer