I am having trouble allowing regular user access samba mount. I can access the mount point as a root, but regular user gets "permission denied" error.
Here is the mount command:
sudo mount -t cifs -o credentials=/home/david/.sambacredentials,sec=ntlm,uid=david,gid=david,file_mode=0775,dir_mode=0775 //192.168.1.12/sdcard Documents/
Here is the error:
$ ls Documents/
ls: cannot open directory Documents/: Permission denied
And here are the mount directory permissions:
d---rwxr-x. 14 filip filip 0 Jun 26 15:30 Documents/
EDIT: smb.conf
[global]
interfaces = wlan0
bind interfaces only = yes
workgroup = WORKGROUP
server string = Samba on Android
netbios name = FILIPSMB
remote announce = 255.255.255.255
encrypt passwords = yes
security = USER
restrict anonymous = 1
load printers = no
printcap name = /dev/null
disable spoolss = yes
deadtime = 5
delete readonly = yes
nt acl support = no
inherit permissions = yes
socket options = SO_SNDBUF=16384 SO_RCVBUF=16384
local master = no
unix extensions = yes
[sdcard]
vfs objects = fake_perms
comment = Android /storage/sdcard0
path = /storage/sdcard0
force user = root
read only = no
writable = yes
guest ok = no
You need to create a common group that contains filip and david. E.g, as root:
group add smbusers
groupmod -A david smbusers
groupmod -A filip smbusers
chown filip:smbusers /path/to/Documents
The documents group should be:
d---rwxr-x. 14 filip smbusers 0 Jun 26 15:30 Documents/
I do NOT recommend permissions of 0075 for Documents, so why not
chmod 0775 /path/to/Documents
The documents group will now be:
drwxrwxr-x. 14 filip smbusers 0 Jun 26 15:30 Documents/
Now try reconnecting as user. (you can also add a list of valid users
for the share in smb.conf
, but for now, let's get the directory and groups in a sane configuration.)
You must also have Documents
be a valid samba share (sorry, I presumed you had already done this). In smb.conf
, create a Documents
share (the name can be anything you like). It will look similar to this based on your previous posting)
[Documents]
comment = Documents Share
path = /full/path/to/Documents
valid users = smbusers # the group you created holding david & filip
browseable = Yes
writeable = Yes
After editing smb.conf, run testparm
which will check for errors and provide a dump of your shares. Then restart samba (both smb and nmb daemons). Confirm that david
has access to the Documents
share with:
smbclient -Udavid -Llocalhost
Then try to reconnect to Documents. (if you experience any problems with the smbclient
command, then substitute your actual hostname for localhost. (that will indicate a failure in wins resolution, to correct, add the following to the global section of smb.conf:
name resolve order = lmhosts wins host bcast