How to setup a SFTP server on CentOS

What is SFTP?

SFTP, is the acronym for SSH File Transfer Protocol, or Secure File Transfer Protocol, is a protocol packaged with SSH that works in a similar way as FTP but over a secure connection. The advantage is the ability to leverage a secure connection to transfer files. In almost all cases, SFTP is preferable to FTP because of its underlying security features and ability to piggy-back on an SSH connection.

FTP is an insecure protocol that shouldn’t be used.

Enable PasswordAuthentication in the sshd config file

Backup the current sshd_config

Change it to READ-ONLY to ensure it don’t get overwritten

Find the line with the phrase PasswordAuthentication and make it read:

Save your new sshd_config file and then restart the host machine’s ssh service:

Connect to your host and login to your user account

To open an SFTP shell terminal as on the host machine, open a Terminal on your client machine and enter the following command, replacing with your host machine’s IP address hostname: