Skip to content

Feature Request: ability to set default current working directory on connection #2

@dundeemt

Description

@dundeemt

When connecting to a standard sftpserver, you are left in the users home directory. i.e. username=test, when you login in you normally are left at /home/test (unless modified by sshd configurations)

However, using the pytest-sftpserver plugin, after the initial connection your are left at /

Do you think it would be possible (within reason) to specify the default directory location if you have a CONTENT structure like:

{'home': {
    'test': {
        'file1.txt': 'file1 contents'
             }
         } 
}

and when the connection is set up for username='test', a request for pwd would result in '/home/test' ?
It wouldn't even have to be that smart, maybe just a default directory arg that if set, results in the above irregardless of login details. If you set a 'bad' default directory it would throw an OSError, if required. Otherwise the error could just be thrown if they try to access a bad file path, like it does currently.

I've implemented a number of tests using the plugin (for the pysftp project), however now that I'm finished I don't like the file system differences between the two test types and I am working on making them go away, but will require that I add a call in the setup for the plugin type tests that sets the directory to the /home/test -- this would be required on all plugin style tests, thus making them a bit different than the tests I have against a local sftpserver.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions