Run SFTP without shell access on Ubuntu 20.04
The tutorial below describes how to get SFTP running without shell access on Ubuntu 20.04
We will do the whole thing by issuing a few commands in the console.
First, we add a user:
1 | sudo adduser pliki |
We create a directory for storing files and give permissions:
1 | sudo mkdir -p /var/sftp/uploads |
1 | sudo chown root:root /var/sftp |
1 | sudo chmod 755 /var/sftp |
We give the user access to the files and directory with files:
1 | sudo chown pliki:pliki /var/sftp/uploads |
We edit the ssh configuration file:
1 | sudo nano /etc/ssh/sshd_config |
And we add at the end:
1 2 3 4 5 6 7 8 | Match User pliki ForceCommand internal-sftp PasswordAuthentication yes ChrootDirectory /var/sftp PermitTunnel no AllowAgentForwarding no AllowTcpForwarding no X11Forwarding no |
Save the file and restart sshd
1 | systemctl restart sshd |
Everything should work, that's all 🙂
Related entries:
Nextcloud problem MySQL is used as a database, but does not support 4-byte characters
Error: username does not appear in the file sudoers. This incident will be reported.
Sublime Text - code editor for webmaster. Installation in Ubuntu
Installing the TeamSpeak voice server Centos7
To clear history Bash in Linux