## Table of Contents
– [Configure FTP Server](#configure-ftp-server
– [Configure SSH Daemon](#configure-ssh-daemon
– [Create SFTP User Account](#create-sftp-user-account
– [User Login via SFTP](#user-login-via-sftp
FTP stands for “File Transfer Protocol” is a popular method of transferring files between two remote systems. SFTP stands for SSH File Transfer Protocol, or Secure File Transfer Protocol is a separate protocol packaged with SSH that works similarly over a secure connection.
SFTP Configuration assumes that you have to configure your FTP server by following the FTP configuration guide. Privileged access to the system as root or via sudo command is required.
## Configure FTP Server
This guide describes FTP over secure SSH protocol. Before starting this guide make sure that you have already configured your FTP server using below link.
## Configure SSH Daemon
If you have not configured till now, you have to install SSH server:
$ sudo apt install ssh
If you want to configure FTP over OpenSSH server, you have to edit the existing SSHD configuration file as below.
$ sudo nano /etc/ssh/sshd_config
Add this below file at the end of the file as below.
Match group sftp
These lines say that users related to sftp group will be able to access their home directories, even though they will be denied SSH shell access.
To apply the new changes you have to restart the SSH server.
$ sudo service ssh restart
## Create SFTP User Account
Now you have to create a new user account which is specific to SFTP service. Now you have to create a new group called sftp:
$ sudo addgroup sftp
Now you have to create a new user sftpuser assign him to the sftp group by using the below command.
$ sudo useradd -m sftpuser -g sftp
You have to set a new password for sftpuser user:
$ sudo passwd sftpuser
At last change access permissions to the user’s home to deny access to it from any others on the same system. To do it use the below command.
$ sudo chmod 700 /home/sftpuser/
## User Login via SFTP
Now the new user called sftpuser can log in to the new sftp server via sftp:// protocol. Now SFTP server can be resolved via eg. hostname ubuntu-sftp use sftp command to create new SFTP connection.
$ sftp sftpuser@testsftp
Now navigate to your home directory and confirm write access by creating a new directory.
sftp> cd sftpuser
sftp> mkdir sftp-test
Now you are connected to SFTP