User Tools

Site Tools


ubuntu:sftp:configuring_the_user_home_directory

Ubuntu - SFTP - Configuring the User Home Directory

In the root of the users home directory, creating symlinks to different parts of the server outside of the users home directory won't work as symlinks are relative to the root directory, which in this case is the user's chrooted home directory.

Instead, you must use mount with –bind.

You first need to create a directory and them mount a directory somewhere else on the server to that directory.

For example:

sudo mkdir /home/sftpuser/www
 
sudo mount --bind /var/www /home/sftpuser/www

This won't work if the /home/sftpuser/www directory existed previously.

Made a mistake? You can unmount a drive using the following command:

sudo umount /home/sftpuser/www

Since typical users don't have the required root access to execute these commands, and they would be lost as soon as you reboot the server.

However you can make these mounts permanent by adding them to the /etc/fstab file using the following command:

sudo vi /etc/fstab

Add the following line to the end of the file and save:

/var/www /home/sftpuser/www none bind

The next time you reboot your server, the directories will automatically be mounted.

ubuntu/sftp/configuring_the_user_home_directory.txt · Last modified: 2020/07/15 10:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki