Search code examples
raspberry-pisftpfilezillawinscp

Change the default SFTP directory on the raspberry pi


I want to use client such as FileZilla or WinSCP to tranfert files to my RPI. This works at the moment but everytime I start the connection the default directory is always /home/pi/

Is it possible to change it to a different repository without changing the setting of the client WinSCP / FileZilla?

Thanks


Solution

  • manual page for sftp-server mentiones switch -d:

    -d start_directory

    specifies an alternate starting directory for users. The pathname may contain the following tokens that are expanded at runtime: %% is replaced by a literal '%', %d is replaced by the home directory of the user being authenticated, and %u is replaced by the username of that user. The default is to use the user's home directory. This option is useful in conjunction with the sshd_config(5) ChrootDirectory option.

    Go to /etc/ssh/sshd_config and add this option with appropriate path to sftp-server value for Subsystem option.