Whit Blauvelt
2012-May-10 23:10 UTC
Is there any method, with ChrootDirectory and internal-sftp, to automatically cd to a subdir on login?
Hi, This is either a query or a feature request. I have a system where sftp users are chrooted using scponly, which while requiring much more setup than OpenSSH's internal-sftp method, has the useful feature of allowing an initial chroot to a subdirectory, typically the one used for file exchange. I've searched for a way to do the same thing with OpenSSH. So far haven't found it. If there is a way, then I can transparently substitute it. Otherwise users would have to do the cd themselves. That's not trivial in my case since a number of the users run scripts which assume that they'll simply drop in their correct directory on login. Thanks for any advice, or consideration of this as a future feature if there's no present method to achieve it. Whit
Peter Stuge
2012-May-10 23:34 UTC
Is there any method, with ChrootDirectory and internal-sftp, to automatically cd to a subdir on login?
Whit Blauvelt wrote:> Thanks for any adviceQuoting sshd_config(8): ChrootDirectory Specifies the pathname of a directory to chroot(2) to after authentication. All components of the pathname must be root- owned directories that are not writable by any other user or group. After the chroot, sshd(8) changes the working directory to the user's home directory. So set the home directory to what you want them to land in, relative the ChrootDirectory root. //Peter
Ángel González
2012-May-16 22:29 UTC
Is there any method, with ChrootDirectory and internal-sftp, to automatically cd to a subdir on login?
On 16/05/12 23:27, Peter Stuge wrote:> ?ngel Gonz?lez wrote: >> Peter Stuge wrote: >>> set the home directory to /files for the relevant users >> If the user folder is /home/username, just change the >> ChrootDirectory to /home/%u, and then make their home >> /home/user1/files > As I wrote, the home directory should be /files in that case. > > > //PeterRight. Sorry for the confusion. Their home directory should be /files, which would map to /home/user1/files, but you set it to /files