You are not logged in.

#1 2019-04-14 18:32:10

simplyjochen
Member
Registered: 2019-04-14
Posts: 2

proper way to set permissions for samba shares

hey fellow archers,

I have configured my desktop and laptop (both running Arch of course) to access my (ubuntu) media/home server's samba share.

I am mounting the shared directory via the fstab. If I only provide credentials (the smb-username matches my local username) the directory is mounted with uid=0. This of course overwrites any ownership and permissions I may set for the mount point.

everything works fine if I set

uid=1000,gid=1000,forceuid,forcegid

in the mount options.

I don't see a real problem here but firstly this doesn't seem elegant and secondly, the wiki discourages this:

Warning: Using uid and/or gid as mount options may cause I/O errors, it is recommended to set/check correct File permissions and attributes instead.

In the discussions page to the article someone already doubted the warning.

File permissions and attributes are to be overwritten by mount.cifs so I don't see a different way to provide them but in the mount options.

What am I missing? What is the proper way to configure this?

Thanks in advance for any clues and help!

Additional information:

My line in

/etc/fstab
//wohnstube/restricted /media/smbwohnstube cifs credentials=/etc/samba/credentials/smbwohnstube,nofail,x-systemd.device-timeout=5,x-systemd.automount,_netdev,iocharset=utf8,uid=1000,gid=1000,forceuid,forcegid 0 0

leads to following:

$ mount
...
//wohnstube/restricted on /media/smbwohnstube type cifs (rw,relatime,vers=default,cache=strict,username=jochen,uid=1000,forceuid,gid=1000,forcegid,addr=192.168.5.1,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,x-systemd.automount,_netdev)

manually mounting with

# mount -t cifs //wohnstube/restricted /media/smbwohnstube/ -o credentials=/etc/samba/credentials/smbwohnstube

results in

$ mount
...
//wohnstube/restricted on /media/smbwohnstube type cifs (rw,relatime,vers=default,cache=strict,username=jochen,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.5.1,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,x-systemd.automount,_netdev)

and

# ls -ld /media/smbwohnstube/
drwxr-xr-x 2 root root 0 12. Apr 23:48 /media/smbwohnstube/

just providing uid= and gid= without the force options is also not enough.


/etc/samba/samba.conf
---
[global]
workgroup = smb
security = user
map to guest = never
[homes]
comment = Home Directories
browsable = no
read only = no
create mode = 0750
[restricted]
valid users = jochen
path = /media/userdata/samba/jochen
public = no
writable = yes
comment = smb restricted share
printable = no
guest ok = no
create mask = 0600
directory mask = 0700

If I can provide you with anything further, just tell me wink

So, my question is: is this an improper way to configure permissions? Am I really risking I/O-errors? If so: how else should I resolve this?

Thanks!

Offline

#2 2019-04-15 10:37:57

simplyjochen
Member
Registered: 2019-04-14
Posts: 2

Re: proper way to set permissions for samba shares

I'm new to this forum and my question didn't receive much attention. Did I post at the wrong spot?

Offline

Board footer

Powered by FluxBB