Server Side
Install the latest version of openssh and openssh-server
mkdir –p /sftp/user/ #create folder for sftp access for the specified user
adduser user #add user
passwd user #change password for the user
groupadd sftpusers #add group
usermod –a –G sftpusers user #add user to group
id user #check if the user is member of the group
usermod –d /sftp/user user #set home directory for user
vi /etc/passwd
user:x:yyy:zzzz::/sftp/user/:/sbin/nologin
vi /etc/ssh/sshd_config
Comment the line
Subsystem sftp /usr/libexec/openssh/sftp-server
Add the following lines
Subsystem sftp internal-sftp
Match Group sftpusers
X11Forwarding no
AllowTCPForwarding no
ChrootDirectory /sftp/%u
ForceCommand internal-sftp
systemctl restart sshd
systemctl enable sshd
Client Side
Install the latest version of openssh
Connect to the sftp server
sftp user@<hostname/public_IP> #if sftp port is default 22
sftp –oPort=<port> user@<hostname/public_IP> #if sftp port is other than 22