Contents
Linux Administration Bootcamp
Installing and Connecting to a Linux System
Linux Fundamentals
Intermediate Linux Skills
Linux Boot Process and System Logging
Disk Management in Linux
LVM - The Logical Volume Manager
User Management in Linux
Networking With Linux
Shell Scripting with Linux
Command Line Kung Fu
In this course, you will learn how to install a Linux system and connect to it, whether that be on Mac or Windows.
In this lesson will be covering how to copy files over the network. You already know how to copy files from one location to another on the same system using the CP command. But if you want to copy files from your local workstation to a Linux server or between Linux servers, you need to use SCP or SFTP. SCP is Secure Copy and SFTP is SSH File Transfer Protocol. Sometimes SFTP is referred to as Secure File Transfer Protocol.
SCP and SFTP are both extensions of the secure shell protocol. In order to use SCP or SFTP you need a client. Mac and Linux come with SCP and SFTP command line utilities. If you are running windows you can use the PuTTY Secure Copy client pscp.exe and the PuTTY Secure File Transfer client psftp.exe. There are graphical clients as well.
Cyberduck is popular for Mac and Windows. FileZilla runs on Mac, Windows and Linux. WinSCP is a Windows only SCP and SFTP client. If you are looking for a more interactive experience where you can examine the local files and remote files use SFTP. With SCP, you need to know what files you want to transfer before issuing the command. SCP and SFTP aren't the only ways to transfer files to remote systems.
Sometimes FTP called File Transfer Protocol is enabled. In such cases, you can use the built-in FTP command line client on Linux and Mac or a graphical client, like WinSCP for Windows. Just be aware that FTP is not a secure transfer protocol like SCP and SFTP. This means that your log in credentials are sent in plain text over the network. Also, the files that you upload and download are not encrypted either. If given the choice between SCP, SFTP or FTP? Pick SCP or SFTP. Let's use our SFTP client to connect to this Linux server.
When you connect to the remote server you're placed into your home directory. And LS will show the files that are in my home directory. If you proceed those commands with an L that's for local. So LPWD says that I'm in the Local Temp Test Directory and LS will show what files are on the local box and temp test. So let's put z.txt onto the server and we'll do an LS and we can see that z.txt shows up on remote server.
Let's deleted off the remote server and let's do an LS with a dash L for a long listing and see if it's gone. And it is, so we'll click our SFTP client. With SCP you can copy from your local system to the remote system, but you need to know the source and destination.
So, our source file will be z.txt our destination will be linuxsvr1: at the end of the server name, followed by a path name. We could put this file and the temp directory on the remote server. Oops I misspelled that. We could put this file and say our home directory. Tilda is a shortcut for home. And let's connect to the Linux server and show that, we did places z text there and also in temp.
Let's transfer this file to the remote server as a different user. Let's use adminuser@linuxsvr and we'll place this in the admin users home directory. We can use Tilda as a shortcut for home or we can even specify the full path, let's just do that. And let's connect, it's the same with SFTP let's connect to a sftpadminuser@linuxsvr. And then you could see that z.txt was transferred.
Let's look at using a graphical client like FileZilla. To connect via SFTP type sftp:: and then the IP address or server name and give your username and password and click quick connect. If you get prompted about an SSH key go ahead and accept it, and this is a one time thing. On the left side you see our local files on our workstation and on the right side are the remote files on the Linux server. We'll just pick a file to transfer up to our Linux server.
Let's put it in our desktop folder and you can drag and drop a file from local to remote and also from remote to local. And you can also do a transfer by double-clicking the file as well. Let's log into our Linux server and see if those files got transferred like we expected. And we can see, that the file is on the desktop double-click to open. Yup, it made it. Let's look at our documents folder and we can see the file is there as well. To transfer files over the network you need a client. There are command line clients like SCP, SFTP and FTP. You can also use a graphical client such as Cyberduck, FileZilla, or WinSCP. If you have a choice to use FTP or SFTP, choose SFTP.
A world-leading tech and digital skills organization, we help many of the world’s leading companies to build their tech and digital capabilities via our range of world-class training courses, reskilling bootcamps, work-based learning programs, and apprenticeships. We also create bespoke solutions, blending elements to meet specific client needs.