Designed to offer a secure means of data sharing between a client and a server, the Secure File Transfer Protocol (SFTP) is an encrypted file transfer protocol. The Secure Shell (SSH) protocol enhances it, which makes it a great option for safely transferring data across a local network or the internet. Between networked hosts, secure file transmission is made possible using the SSH File transmission Protocol (SFTP), sometimes referred to as the Secure File Transfer Protocol.
SSH2 encryption is used by the command-line secure file transfer software (SFTP) as well as graphical SFTP clients like WinSCP and Fetch to authenticate and establish secure channels between networked computers. You may drag and drop icons between windows with graphical SFTP clients, which makes file transfers easier.
A computer’s file system is represented by each window, and each icon denotes a file or directory. Upon launching the application, you have to provide the name of the remote host you wish to connect to and confirm your identity using the host’s login and password. CyberDuck (for macOS) and WinSCP (for Windows) are two graphical SFTP clients that are available to instructors, staff, and students. Another Open-Source program that you can use alternatively is Warpinator.
Why use SFTP Client?
The remote file system administration features of SFTP, in contrast to Secure Copy Protocol (SCP), enable applications to list the contents of remote directories, remove remote files, and resume interrupted file transfers. You cannot connect to an SFTP server using a regular FTP client, despite the fact that SFTP clients and FTP clients share many functional similarities. This is because each type of client uses a distinct protocol. You can learn about FTP commands on Linux from this article here.
As a result, SFTP, or secure file transfer protocol, is more secure than FTP, or simple file transfer protocol. You may need to grant remote access to the SFTP/FTP server to development teams or other clients on occasion. Here, you can grant secure, restricted access to particular directories and files using SSH File Transfer Protocol.
First of all, install OpenSSH Server on your system:
sudo apt install ssh
Now, we have to modify the SSHD configuration:, you can do this by running the following command:
sudo nano /etc/ssh/sshd_config
Now, paste the following lines at the end or bottom of the file:
Match group sftp
Save and exit out of the editor by pressing Ctrl+O and Ctrl+X respectively. Finally, restart the SSH service:
sudo systemctl restart ssh
Now, create a new SFTP user by running the following commands in your terminal window:
sudo addgroup sftp
sudo useradd -m sftp_user -g sftp
Set the password for the newly created SFTP user by typing the following command:
sudo passwd sftp_user
Make sure to only enable access for the user in this directory. Any other user will be denied access to this directory on the system.
sudo chmod 700 /home/sftp_user/
Login through SFTP
You can use the system hostname or IP address to create an SFTP connection. We’ll establish a connection to the SFTP server in this example, which is located on the same machine as we configured it.
Step 1: Connect to SFTP
Open a Terminal. Using the sftp_user’s name, connect to the SFTP server with the loopback address of 127.0.0.1.
Step 2: Check if it works
Navigate to the user’s home directory and create a new directory named ‘test-sftp’.
And congratulations! You’ve effectively set up your Ubuntu 20.04 environment to run a SFTP server.
In addition to being useful, our secure file transfer solution guarantees the integrity and protection of your data while it is being transferred. Your SFTP server is prepared to handle whatever task you throw at it, including remote backup creation and file sharing with coworkers.
As well as being helpful, this file transfer solution ensures the trustworthiness and security of your information while it is being transferred. Whether you need to create remote backups or share files with coworkers, your SFTP server can do the job effectively and efficiently.
- Setting up a SFTP server on LinuxHint
- Useful Commands for SFTP
- University Information Technology Services article on using SFTP