Fedora

How to Setup SFTP Server on Fedora Linux

SFTP, or Secure File Transfer Protocol, is a robust solution to safeguard the file transfers in today’s digital landscape. By encrypting both data and authentication processes, it ensures the confidentiality and security. SFTP servers facilitate the secure file exchanges, enabling the individuals and organizations to transfer the sensitive data seamlessly. You configure the access permissions and user groups, restricting the SFTP access to the designated users or groups.However, setting the SFTP server can be difficult on Fedora Linux for those unfamiliar with commands. So, in this tutorial, we will explain the simplest way to setup an SFTP server on Fedora Linux with a few simple steps.

How to Setup the SFTP Server on Fedora Linux

Let’s begin by updating the Fedora system as per the latest updates available:

sudo dnf update

Now, run the following command to install the OpenSSH server in the system:

sudo dnf install openssh-server

Once you install the OpenSSH server, start the SSH service and enable it to start automatically at boot:

sudo systemctl start sshd

sudo systemctl enable sshd

sudo systemctl status sshd

To configure the SFTP access, edit the SSH server configuration file:

sudo nano /etc/ssh/sshd_config

In this config file, uncomment the following line:

Subsystem sftp internal-sftp

If you want to restrict the SFTP access to specific users or groups, add these lines at the end of the file:

Match Group sftpTEAM

ChrootDirectory /home/%u

ForceCommand internal-sftp

AllowTcpForwarding no

PasswordAuthentication yes

This configuration restricts the SFTP access to the users belonging to the “sftpTEAM” group, chroots them to their home directories, and enforces SFTP only. If needed, create an SFTP-only group to which you can add the users:

sudo groupadd sftpTEAM

To grant the SFTP access to specific users, add them to the “sftpTEAM” group (or any other group you created):

sudo usermod -aG sftpTEAM username

After configuring the SSH server, restart the SSH service to apply the changes:

sudo systemctl restart sshd

Your SFTP server is now set up on Fedora Linux. Users in the specified group (e.g., “sftpTEAM”) can securely transfer the files to and from their home directories using SFTP. Ensure that the user permissions and access control meet your security requirements.

Conclusion

This is all about the brief method that you can use while setting up the SFTP server on Fedora Linux with no hassles. The SFTP server ensures the secure file transfer with diverse user permissions. Hence, we recommend you to add only the specific users on your server, or you may face privacy and security-related issues. Moreover, you can easily create groups to handle the user permissions.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.