I need to mount an external shared resource using sshfs
. I have setup SSH authentication between my PC and the server using a local user (non-root) and it works like a charm using the following command:
sshfs rperez@<server_ip>:/home/rperez/shared -p 2051 ~/shared -o auto_cache,reconnect
Now I need to share the mounted resource with a Docker container as a volume but apparently this is not possible without run the command above using sudo
. This is the output for run the command above as sudo
:
$ sudo sshfs rperez@<server_ip>:/home/rperez/shared -p 2051 ~/shared -o auto_cache,reconnect[sudo] password for rperez: fuse: bad mount point `/home/rperez/shared': Transport endpoint is not connected
And the mount point turns into red with ?
as first character and becomes non accessible meaning ?shared
(red because I am seeing from mc`.
I've tried to setup SSH authentication with sudo
but apparently is not possible as per the answer on this post. I have read a few ones about this (3, 4, 5, 6) topic but I can't get this to work.
Any advice? What I am missing here?
Update:
Following the suggestion from @Xaloroues I have running the following commands:
$ sudo mkdir shared$ sudo sshfs rperez@<server_ip>:/home/rperez/shared -p 2051 /mnt/shared -o auto_cache,reconnectrperez@<server_ip> password:
The mount command works but I can't access the mounted resource. I have run the following command and see the output:
$ sudo stat /mnt/shared[sudo] password for rperez: File: 'shared' Size: 4096 Blocks: 8 IO Block: 4096 directoryDevice: 32h/50d Inode: 1 Links: 1Access: (0775/drwxrwxr-x) Uid: ( 1041/ UNKNOWN) Gid: ( 1038/ UNKNOWN)Access: 2016-09-30 10:27:28.000000000 -0400Modify: 2016-09-21 15:20:20.000000000 -0400Change: 2016-09-21 15:20:20.000000000 -0400 Birth: -
Also see this pic about how the mounted folder looks like:
The permissions before mount the shared resources seems to be fine:
$ ls -la /mnt/total 16drwxr-xr-x. 4 root root 4096 Sep 30 10:35 .dr-xr-xr-x. 18 root root 4096 Sep 30 08:10 ..drwxr-xr-x 2 root root 4096 Sep 30 10:35 shared
So, what's wrong?