Question

Changing Default directory on SFTP login

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 :)


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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/.