更改 raspberry pi 上的默认 SFTP 目录

Change the default SFTP directory on the raspberry pi

我想使用 FileZilla 或 WinSCP 等客户端将文件传输到我的 RPI。这目前有效,但每次我启动连接时,默认目录始终是 /home/pi/

是否可以在不更改客户端 WinSCP / FileZilla 设置的情况下将其更改为不同的存储库?

谢谢

sftp-server 的手册页提到开关 -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.

转到 /etc/ssh/sshd_config 并添加此选项以及 Subsystem 选项的 sftp-server 值的适当路径。

Winscp使用ctrl-o保存位置到列表,你可以select它。