Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] sshfs does not mount for user as specified in fstab
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Eunha
n00b
n00b


Joined: 28 Dec 2021
Posts: 6

PostPosted: Tue Dec 28, 2021 4:08 am    Post subject: [solved] sshfs does not mount for user as specified in fstab Reply with quote

My current fstab line is as follows (works perfectly in arch linux):
Code:
remote@192.168.0.3:/mnt/disk /home/local/remote-disk fuse.sshfs defaults,users,_netdev,allow_other,allow_root,IdentityFile=/home/local/.ssh/key,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,uid=1000,gid=1000,idmap=user 0 0

It does mount, however, my user has no access to it. I enabled fuse as a module in the kernel and installed with the suid use flag. To make sure, I created a file at /etc/portage/package.use with:
Code:
sys-fs/fuse suid

And then:
Code:
emerge --update --newuse sys-fs/fuse

Any idea what's going on?


Last edited by Eunha on Wed Dec 29, 2021 7:27 am; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21631

PostPosted: Tue Dec 28, 2021 4:50 pm    Post subject: Reply with quote

Why does your user have no access to it? Does it appear unmounted for that user? Are the apparent Linux filesystem permissions such that you cannot access it (such as root:root rwx------)? Can root on the local system access it?
Back to top
View user's profile Send private message
Eunha
n00b
n00b


Joined: 28 Dec 2021
Posts: 6

PostPosted: Wed Dec 29, 2021 1:14 am    Post subject: Reply with quote

Hu wrote:
Why does your user have no access to it?
That's what I'm trying to figure out. Everything works perfectly in arch. Maybe it has to do with some obscure difference between openrc and systemd.
Hu wrote:
Does it appear unmounted for that user? Are the apparent Linux filesystem permissions such that you cannot access it (such as root:root rwx------)? Can root on the local system access it?
It appears mounted just fine and root does have access. These are the current permissions:
Code:
local:local rwxr-xr-x 1
I'm probably going to reinstall gentoo, I've tried everything I could think of.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21631

PostPosted: Wed Dec 29, 2021 3:06 am    Post subject: Reply with quote

What happens when your local user tries to access it? What is the output of id?

Why are you using sshfs for this? Would a different transport be more suitable?

Reinstalling Gentoo is very unlikely to fix this.
Back to top
View user's profile Send private message
Eunha
n00b
n00b


Joined: 28 Dec 2021
Posts: 6

PostPosted: Wed Dec 29, 2021 4:01 am    Post subject: Reply with quote

I get permission denied. I use sshfs for file share, nothing special.
Code:
uid=1000(local) gid=1000(local) groups=1000(local),10(wheel),18(audio),27(video),100(users)
The only thing I can think of is the init system, it's the first time I'm using openrc to mount sshfs. How does openrc handle fstab?
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1660

PostPosted: Wed Dec 29, 2021 4:12 am    Post subject: Reply with quote

Eunha wrote:
I get permission denied. I use sshfs for file share, nothing special.
Code:
uid=1000(local) gid=1000(local) groups=1000(local),10(wheel),18(audio),27(video),100(users)
The only thing I can think of is the init system, it's the first time I'm using openrc to mount sshfs. How does openrc handle fstab?


As part of the netmount script, it checks for $net_fs_list then, if found in fstab, runs: mount -a -O _netdev

Code:
 net_fs_list="afs ceph cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre ncpfs nfs nfs4 ocfs2 shfs smbfs"


It is recommended to edit /etc/conf.d/netmount to exactly specify the network service required as the rc_need value and commenting out the default.

Edit: It doesn't check but does a 'mount -at ${net_fs_list/ /,}' first, then the _netdev after.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Wed Dec 29, 2021 4:30 am    Post subject: Reply with quote

File share with root access?! I thought there must be something of really special purpose if root is allowed.

NFSv4 is ideal for file sharing, it can be secured with Kerberos if you wish.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!


Last edited by Jaglover on Wed Dec 29, 2021 4:33 am; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21631

PostPosted: Wed Dec 29, 2021 4:33 am    Post subject: Reply with quote

sshfs is useful if you cannot configure the server to support something better, but is generally not the best choice if you have full privilege on both sides and can configure another transport.

What is the output of grep remote /proc/self/mounts while the sshfs mount is active in Gentoo?
Back to top
View user's profile Send private message
Eunha
n00b
n00b


Joined: 28 Dec 2021
Posts: 6

PostPosted: Wed Dec 29, 2021 7:27 am    Post subject: Reply with quote

I got it working somehow. In my remote machine, the storage has uid=1003 and gid=1003. As soon as I changed both to 1000, it started working. The uid and gid options in fstab were not behaving as I expected. Weirdly enough, now I get 'connection reset by peer' in both gentoo and arch during the boot process. After logging, I can mount normally. I'm not sure what happened, the uid and gid options were supposed to create an abstraction layer in order to give my user access to the storage. Anyways, thanks for the help.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21631

PostPosted: Wed Dec 29, 2021 5:07 pm    Post subject: Reply with quote

In most transports, and I think sshfs is not an exception here, uid=/gid= affect the mount as seen on the client. That let you set the local uid/gid so that the local kernel would permit you to attempt the access. You still need permission on the server, so if remote@192.168.0.3 did not have permission to read files in /mnt/disk, then you cannot read the files via sshfs either.

Are you sure Arch was also logging in as the same remote user?
Back to top
View user's profile Send private message
Eunha
n00b
n00b


Joined: 28 Dec 2021
Posts: 6

PostPosted: Thu Dec 30, 2021 5:16 am    Post subject: Reply with quote

Just to clear things out, I'm not using sshfs in production or anything, I'm just trying to setup a simple file share for learning purposes. I followed the checklist in the troubleshooting section of the sshfs article in arch's wiki. More specifically, items 3 to 5. The fstab line was the same, I only changed the path to the key.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum