SFTP - How to Change the Default SFTP folder from home\user

Hello Everyone,

I need a guide to help me change the SFTPs default home\user to a custom location. I am still new to SFTP, and I am finding ways on how to accomplish this.

I have a 32GB Flash Drive that I needed to access securely online via SFTP. I managed to make it work thanks to online resources and end up using Open SSH, as it was recommended for SFTP on the DietPi.

I have also learned the FTP and SFTP are totally different Protocols. And that I manged to understand the reason behind why I can easily change FTP default location, but find it hard for SFTP.

SFTP access worked, but it points to home\user. I can also navigate back to root and go to mnt\drive. While it’s great, the only reason I would like to change the default is for me to isolate the root for access. And to avoid accidental deletion or filling up of files on the home\user as well.

On SFTP clients (applications), I can make a custom start location to my desired folder. However I can still go down and access the root.

I would be grateful if someone can help me out with this.

Thank you,

Infiltraitor

You are able to change the default directory in /etc/ssh/sshd_config as described here.

Alternatively, you could create a dedicated user for sftp and mount the flash drive not to e.g. /mnt/drive but to somewhere inside /home/sftp-user/.

Regards, rasputin

/

@rasputin
Thank you for your feedback, I will be testing your suggestion and will be replying anytime after I managed to make it work on my device.

edit: A have been visiting that site prior to joining this community, unfortunately the link that lead to Wayback Machine is no longer working. I will try to access, I am not sure if our ISP is blocking it.

The link https://debian-administration.org/articles/590 gives me a blank page.