Report this

What is the reason for this report?

Changing Default directory on SFTP login

Posted on November 1, 2015

Hello Whenever I SFTP login using FileZilla, It opens up /home/MYUSERACCOUNT I would want to open the folder usr/share/nginx/html/ by default when I login. (usr/share/nginx/html/ is the default directory where .html files are stored for my website) Is there a way to do so? Thanks :)



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You can set the default remote directory in FileZilla and FileZilla will cd in that directory when you connect to the site. To do this, you need to go to FileZilla’s Site manager and add or click on the site. Then click on the Advanced tab and you will see a field named “Default remote directory”. You can enter /usr/share/nginx/html/ and click ok to save it. Now when you connect to the site, it will automatically cd into /usr/share/nginx/html/. :)

@prashantsani - Alternatively, you could simply modify the home directory for your user. You’ll need to login to the CLI as root and issue the following command:

usermod -d /usr/share/nginx/html/ username

Broken down:

usermod is the user modification command

-d is the directory to set as the new home for username

… where username is the name of the user you’re logging in as. This effectively removes /home/username/ as the home directory and replaces it with the one you specify above which, in this case, will be /usr/share/nginx/html/.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.