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:
Installing vsftpd on a Debian system 11
gconf-service gconf-service-backend gconf2-common libappindicator1 libc++1 libc++1-9 libc++abi1-9 libdbusmenu-gtk4 libgail-common libgail18 libgconf-2-4 libgtk2.0-0 libgtk2.0-bin libgtk2.0-commonAll-in-one voice and text chat for gamers
All-in-one voice and text chat for gamers that's free 22.04
Installing Oracle Java 16 and Ubuntu 20.04, 18.04, 20.10
The following tutorial describes how to install FFmpeg 5.0 w Ubuntu 20.04
Installing Master PDF editor in Ubuntu 22.04