[ 
https://issues.apache.org/jira/browse/SSHD-825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16490645#comment-16490645
 ] 

Quinn Stevenson commented on SSHD-825:
--------------------------------------

I just tried this in my sftp-junit project, and when I combine it with an 
override of the getDefaultDirectory method (pasted below), it does what I'm 
after. 

@Override
public Path getDefaultDirectory() {
    String user = env.getEnv().get("USER");
    if (user != null && !user.isEmpty()) { 
        Path homeDir = fileSystem.getPath(defaultDir.toString(), "home", user);
        if (Files.exists(homeDir)) {
            return homeDir;
       }
    }

    return defaultDir;
}

Is there a way to add entries to the 'env' object?  I'm wondering if I could 
add 'HOME' to the env and it existed, it would accomplish what I'm after 
without a new/special filesystem.

> Add support for non-chrooted SFTP users with a virtual filesystem
> -----------------------------------------------------------------
>
>                 Key: SSHD-825
>                 URL: https://issues.apache.org/jira/browse/SSHD-825
>             Project: MINA SSHD
>          Issue Type: Improvement
>    Affects Versions: 1.7.0
>            Reporter: Quinn Stevenson
>            Assignee: Guillaume Nodet
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> When the SshServer is configured for SFTP with a VirtualFileSystemFactory, 
> the user is always chrooted to either the defaultHomeDir or the specific 
> homeDir for the user.
> However, in order to simulate systems that are configured such that users are 
> not chrooted, there should be a way to configure the system with a virtual 
> root and a home directory for the use in that virtual root that is also the 
> initial directory for the user when they login.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to