Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to change mount_path_base by configuration #4

Open
renekliment opened this issue May 17, 2016 · 5 comments
Open

Ability to change mount_path_base by configuration #4

renekliment opened this issue May 17, 2016 · 5 comments

Comments

@renekliment
Copy link

renekliment commented May 17, 2016

It would be great if the mount path (currently fixed /mnt/sshfs) were configurable by the user.

Edit: Ah, just noticed it's under Known limitations. Well, let's keep this issue for better reference and discussion then.

@semyon-san
Copy link
Contributor

Why is it not inherently possible to mount under different directory?

@spantaleev
Copy link
Owner

For simplicity, it only uses one directory, which it "believes to control exclusively".

sftpman believes that /mnt/sshfs/ is its own and nothing else mounts under that directory.
This way, it knows that anything it finds there is an sftpman-managed system.

Figuring out which systems are mounted now is as simple as this code in EnvironmentModel (sftpman/model.py):

    def get_mounted_ids(self):
        # Looking for /mnt/sshfs/{id} in output that looks like this:
        # user@host:/remote/path on /mnt/sshfs/id type fuse.sshfs ...
        # "mount -l -t fuse.sshfs" cannot be used, as it requires root privileges
        mounted = shell_exec('mount -l')
        regex = re.compile(' %s(.+?) type fuse\.sshfs' % self.mount_path_base)
        return regex.findall(mounted)

Thinking about it, the above code is a little fragile (as it depends on the above assumption of exclusive control over /mnt/sshfs/).


If we want to have custom mount directories, the above code needs to be more complicated.

The UI in sftpman-gtk also needs to be more complicated to account for custom mount paths.

Having custom mount paths also introduces additional failure scenarios (permissions problems for some paths, but not for others, etc.)

Surely, it's possible to do, I just haven't felt the need to implement it and no one has contributed it.
If there's enough interest, however, we can do it.

@MorganRodgers
Copy link

+1 for this. Apple has decided that the root file system shall be read only, so sftpman does not work on the newest versions of macOS.

@D-Vaillant
Copy link
Contributor

Took a stab at writing the beginnings of this feature. As far as I can tell sftpman doesn't have an application-level settings file, so I added one in json for consistency.
https://github.com/D-Vaillant/sftpman/blob/chdir_mountpassbase/sftpman/model.py#L20

Another way of implementing this would be having the mount directory be defined absolutely by systems, defaulting to /mnt/sshfs/{system_name}.

@spantaleev
Copy link
Owner

This seems like a good beginning.

I'd rather we enable it for all platforms and not make it depend on a flag (like CONFIG_SUPPORT) that distributors would flip or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants