View previous topic :: View next topic |
Author |
Message |
Eunha n00b
Joined: 28 Dec 2021 Posts: 6
|
Posted: Tue Dec 28, 2021 4:08 am Post subject: [solved] sshfs does not mount for user as specified in fstab |
|
|
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:
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 |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21631
|
Posted: Tue Dec 28, 2021 4:50 pm Post subject: |
|
|
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 |
|
|
Eunha n00b
Joined: 28 Dec 2021 Posts: 6
|
Posted: Wed Dec 29, 2021 1:14 am Post subject: |
|
|
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 |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21631
|
Posted: Wed Dec 29, 2021 3:06 am Post subject: |
|
|
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 |
|
|
Eunha n00b
Joined: 28 Dec 2021 Posts: 6
|
Posted: Wed Dec 29, 2021 4:01 am Post subject: |
|
|
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 |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1660
|
Posted: Wed Dec 29, 2021 4:12 am Post subject: |
|
|
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 |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
Posted: Wed Dec 29, 2021 4:30 am Post subject: |
|
|
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 |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21631
|
Posted: Wed Dec 29, 2021 4:33 am Post subject: |
|
|
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 |
|
|
Eunha n00b
Joined: 28 Dec 2021 Posts: 6
|
Posted: Wed Dec 29, 2021 7:27 am Post subject: |
|
|
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 |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21631
|
Posted: Wed Dec 29, 2021 5:07 pm Post subject: |
|
|
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 |
|
|
Eunha n00b
Joined: 28 Dec 2021 Posts: 6
|
Posted: Thu Dec 30, 2021 5:16 am Post subject: |
|
|
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 |
|
|
|