Ah, I see. It's currently not supported unfortunately : please raise a JIRA for that. In the mean time, you should derive the SftpSubsystem class and override the getDefaultDirectory method to return the Path you want for the given user.
Guillaume 2018-05-24 21:00 GMT+02:00 Quinn Stevenson <[email protected]>: > Yeah - I’ve tried that. What it does is set’s the root of the virtual > filesystem to a different spot for that user. So if I set the > defaultHomeDir to target/sftp and the userHomeDir for my test user to > target/sftp/home/user, the “root” of the virtual filesystem is > target/sftp/home/user. What I need is the root of the virtual filesystem > to be target/sftp, and the initial/login directory for the user to be > target/sftp/home/user. > > I think I need to set the “current directory” for the user when they > login, but I have no idea how to do that on the SSHD server. > > Hopefully that helps describe what I’m trying to do. > > > > On May 24, 2018, at 8:56 AM, Guillaume Nodet <[email protected]> wrote: > > > > Have you tried setting home dirs for your users on the > VirtualFileSystemFactory > > ? > > > > vfsf.setUserHomeDir("the user", the_home_dir); > > > > 2018-05-24 15:49 GMT+02:00 Quinn Stevenson <[email protected] > >: > > > >> I’m using Mina SSHD (1.7.0) as an embedded SFTP server for unit testing, > >> and I’ve come across an issue I can’t figure out. > >> > >> I’m looking for a way to set the initial directory in a virtual > filesystem > >> for a user when the login to the SFTP server. > >> > >> I’m simulating some systems that have not chroot-ed their SFTP users, so > >> the initial directory for the user is /home/username, but the users can > >> access the entire filesystem (I know - not a good idea, but I didn’t set > >> this up). > >> > >> My problem is that when I setup the SFTP sever using Mina SSHD with a > >> VirtualFileSystemFactory, the user is always placed in the “root” > directory > >> (i.e. / ) when they login. This makes is really hard for me to simulate > >> navigating the virtual filesystem in my tests because the paths are > >> different. > >> > >> Any ideas/suggestions would be greatly appreciated!! > >> > >> Quinn Stevenson > >> > >> > >> > > > > > > -- > > ------------------------ > > Guillaume Nodet > > -- ------------------------ Guillaume Nodet
