Guide to Installing SFTP Client on Linux

Installing SFTP Client On Linux

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.


Installation Guide

First of all, install OpenSSH Server on your system:

sudo apt install ssh
Install SSH On Linux
Installing SSH On Linux

Now, we have to modify the SSHD configuration:, you can do this by running the following command:

sudo nano /etc/ssh/sshd_config
Opening The File Using Nano
Opening The File Using Nano

Now, paste the following lines at the end or bottom of the file:

Match group sftp
ChrootDirectory /home
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
Modifying SSHD Config
Modifying SSHD Config

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
Create SFTP Group
Create SFTP Group

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/
Enable Working Directory
Enable Working Directory

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.

sftp sftp_user@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’.

cd sftp_user
mkdir test-sftp
ls
Check If SFTP Is Working
Check If SFTP Is Working

And congratulations! You’ve effectively set up your Ubuntu 20.04 environment to run a SFTP server.

Conclusion

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.


References