Re: Different root and initial directories for SFTP

2018-05-25 Thread Quinn Stevenson
I created https://issues.apache.org/jira/browse/SSHD-825 
 

Quinn Stevenson
qu...@pronoia-solutions.com
(801) 244-7758



> On May 25, 2018, at 4:43 AM, Stefan Magnus Landrø  
> wrote:
> 
> That's what I do.
> 
> 2018-05-25 10:37 GMT+02:00 Guillaume Nodet :
> 
>> 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 :
>> 
>>> 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 
>> 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 <
>> qu...@pronoia-solutions.com
 :
 
> 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
>> 
> 
> 
> 
> -- 
> BEKK Open
> http://open.bekk.no
> 
> TesTcl - a unit test framework for iRules
> http://testcl.com



Re: Different root and initial directories for SFTP

2018-05-25 Thread Guillaume Nodet
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 :

> 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  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  >:
> >
> >> 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


Re: Different root and initial directories for SFTP

2018-05-24 Thread Quinn Stevenson
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  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 :
> 
>> 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



Re: Different root and initial directories for SFTP

2018-05-24 Thread Guillaume Nodet
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 :

> 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