How to Setup sFTP Server on Ubuntu 20.04?
Jump to navigation
Jump to search
Step 1:- Install SSH Server
sudo apt-get install ssh-server -y
Step 2:-Configure FTP on sshd_config
/etc/ssh/sshd_config
Step 3:- Edit sshd_config file by using the following command
sudo vi /etc/ssh/sshd_config
Step 4:- Comment the following in the file
#Subsystem sftp /usr/lib/openssh/sftp-server and append the following to file · Subsystem sftp internal-sftp · Match group ftpaccess · ChrootDirectory %h · X11Forwarding no · AllowTcpForwarding no · ForceCommand internal-sftp
Step 5:- Restart ssh service
sudo systemctl restart ssh
Step 6:- Create SFTP user account & add group using following command:
sudo addgroup sftp
sudo useradd -m sftpUser -g sftp
Step 7:- Set password
sudo passwd sftpUser New password: Retype new password: passwd: password updated successfully
Step 8:- Finally,Change permission for other user on system deny access
sudo chmod 700 /home/sftpUser # /home/<username>
Step 9:- Test login via SFTP
sftp sftpUser@<ip or hostname>
Step 10:- If we get connection closed error need to change sshd_config file
vi /etc/ssh/sshd_config PasswordAuthentication no # to PasswordAuthentication yes
Step 11:- Restart ssh service
sudo systemctl restart ssh
Step 12:- If it is connected we can test connect via filezilla