I have important files in two different locations, one mounted at /home
and another at /mnt/my_storage
. I'd like to get the folders of /mnt/storage
and with /home/Downloads
to be accessible over ssh. I currently have it setup using multiple (too many) mount binds. I don't like the idea of having a drive mounted at different locations. Is it possible in any other way? (Maybe symlinks?)
Edit : I've chrooted the user, if that's important.
1 Answer
You can access the complete file system hierarchy over ssh
(I assume you mean scp
) as long as the SSH user has the file system permissions to do so.
If you mount via sshfs
or gvfs
and you don't give a base folder, your home directory will be used, but if you do give a base folder (/mnt
) you can directly access that location.
EDIT
With the additional information of the chroot
jail: This is designed to make all parts of the file system tree, that is not mounted inside the chroot
jail completly invisible. This implies, that symlinks pointing out of the jail are broken (and must be so if the chroot
works as expected).
So basically, if you do use chroot
you must mount inside the jail (possibly via bind
). If you are prepared to sacrifice the jail, you can use them.
N.B. The value of chroot
is often overestimated: If you have a shell, it's trivial to bypass it, and if you don't have a shell the only protection it offers is against too lose file permissions.
-
I'm using opeenssh. The user has permission to the drives but I cannot follow symlinks. To mention, I have chrooted the user to a directory as I don't want them to access all the files, only the media files are shared. How to do that using something other than mount bind? May 21, 2019 at 22:28
-
3If you
chroot
you lock the user out of most of the file system tree - and of course you break symlinks. You should also mention this in the Question. May 21, 2019 at 22:40