I've created a user and made his home directory /var/www/mysite/ftpdir
I've also added a Match user entry for this user in sshd_config
with a ChrootDirectory that points to /var/www/mysite
I've restarted ssh
to pick this up.
When I log in with sftp - the user still goes to the user's old directory ie /home/user
What am I missing?
This is the process:
Add the user to the group:
sudo usermod -aG www blub
as in Whats the simplest way to edit and add files to "/var/www"?or just use
sudo adduser <username> www-data
sudo apt-get install vsftpd
Configure vsftpd for remote access:
sudo nano /etc/vsftpd.conf
and inside the file setand ensure this is commented out:
as per documentation.
sudo service vsftpd restart
Configure the user's home directory to the web directory (not in
/home
):Configure ssh chroot
add the following to the end:
and ensure that further up in the file that this is commented out (ie before the one you just added)
Restart ssh
Change the permissions for apache:
As in the docs here.
Ensure that your directory has www-data access
I've a simple method and that worked for me for apache.
That's it in case you still face permission issue use
chmod
andchown
to address them according to your needs.If you are getting connection refused error at end then make sure that "Subsystem sftp internal-sftp" is place after "UsePAM yes". If not then update and Restart ssh and it worked.