You are not logged in.

#1 2016-07-26 21:55:57

radiopayola
Member
Registered: 2016-07-13
Posts: 5

[SOLVED] fstab cif mount point ownership

I'm trying to mount a samba share using an entry in /etc/fstab.  My fstab looks sort of like this:

# <file system>         <dir>                   <type>  <options>                       <dump>  <pass>                              

## System                                                                                                                        
/dev/sda3         /               ext4      defaults,noatime             0 1

## samba share test  
//server/share   /home/user/share   cifs    username=user,password=pass  0 0

I've tried to mount this in /media/share and ~/share.  I've also tried this while using gdm to load gnome and also after disabling gdm.service and booting straight to the bash prompt.  Unmounted and ran "mount -a" a couple of times in both shells.  Every time the share is mounted, the ownership of the mount point changes from the logged in user to 1000:gnome-initial-setup like so:

Before:

[user@host ~]$ ls -la
total 180
drwxr-xr-x  2 user group  4096 Jul 26 12:53 share

After:

[user@host ~]$ mount -a
mount: only root can use "--all" option
[user@host ~]$ sudo mount -a
[sudo] password for user: 
[user@host ~]$ ls -la
total 176
drwxrwx---+  5     1000 gnome-initial-setup     0 Jul 22 10:09 share

Because of this, when I try to view the share through this mount point, bash and GNOME Files both tell me I don't have permission:

[user@host ~]$ ls ~/share/
ls: cannot open directory '/home/user/share/': Permission denied
[user@host ~]$ 

In case anyone's wondering, I removed the gnome-initial-setup package after noticing the ownership issue.  Same results.  I created a simple script to mount the share with gvfs and run at gnome startup, but I don't like that I have to access the share through /run/user/1001/gvfs when I'm not using GNOME Files.   Any idea how I might be able to fix this?

Last edited by radiopayola (2016-07-27 03:47:47)

Offline

#2 2016-07-27 01:49:25

osalas
Member
From: Kaiserslautern, Germany
Registered: 2015-08-05
Posts: 25

Re: [SOLVED] fstab cif mount point ownership

Try:

//server/share   /home/user/share   cifs    username=user,password=pass,uid=<yourpcusername>  0 0

I had the same problem, it was just that the system was mounted but it was not "mine"

//192.168.1.4/Media /mnt/Media cifs username=*****,password=*****,uid=sampleuser,x-systemd.automount 0 0

This is what it looks in mine

Last edited by osalas (2016-07-27 01:49:50)

Offline

#3 2016-07-27 03:34:14

radiopayola
Member
Registered: 2016-07-13
Posts: 5

Re: [SOLVED] fstab cif mount point ownership

Thanks...  That did it.  I used the "id" command to find the numeric identifiers for the logged in user and its groups.  Might not be necessary, but that's how I interpreted "uid."  I then tested each of the following fstab entries separately, and they both worked:

## samba share test  
//server/share   /home/user/share   cifs    username=user,password=pass,uid=1001  0 0
## samba share test  
//server/share   /home/user/share   cifs    username=user,password=pass,gid=1001  0 0

The second one seems more correct because it gets rid of the strange "gnome-initial-setup" group ownership identifier when I do an "ls -la".  Apparently, one or both of these options should be specified when the samba server doesn't provide ownership information.  I'm guessing you could configure the ownership information on the server in smb.conf...

https://www.samba.org/samba/docs/man/ma … ifs.8.html

uid=arg
sets the uid that will own all files or directories on the mounted filesystem when the server does not provide ownership information. It may be specified as either a username or a numeric uid. When not specified, the default is uid 0. The mount.cifs helper must be at version 1.10 or higher to support specifying the uid in non-numeric form. See the section on FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS below for more information.

gid=arg
sets the gid that will own all files or directories on the mounted filesystem when the server does not provide ownership information. It may be specified as either a groupname or a numeric gid. When not specified, the default is gid 0. The mount.cifs helper must be at version 1.10 or higher to support specifying the gid in non-numeric form. See the section on FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS below for more information.

I guess I'll mark this solved and create a credentials file. Thanks again...

Last edited by radiopayola (2016-07-27 04:05:57)

Offline

Board footer

Powered by FluxBB