OK, I'm a Linux newbie... I followed this tutorial https://linuxconfig.org/how-to-setup-sftp-server-on-ubuntu-18-04-bionic-beaver-with-vsftpd
My objective is to create a new user with access vía SFTP to /var/www
Following the tutorial, I edited sshd_config
sudo nano /etc/ssh/sshd_config
and added this to the file:
Match group sftp
ChrootDirectory /home
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
and restarted SSH.
sudo service ssh restart
I created a new group
sudo addgroup sftp
and a new user.
sudo useradd -m sftpuser -g sftp
I set the user password.
sudo passwd sftpuser
After this, when I try to connect to the server using SFTP, it works but when I go to /var/www, I get this error in FileZilla:
Comando: cd "/var/www"
Error: Directory /var/www: no such file or directory
Error: Error al recuperar el listado del directorio (error on retrieving directory listing)
I need this user to be able to access /var/www as this is his only function. The server has other users and I'm worried about breaking something if I mess arround with the permission of folders.