17

I'm having trouble with read/write permissions on my Samba server, how do I fix my smb.conf and file permissions to have a more unified access?

smb.conf

[global]
workgroup = workgroup
netbios name = LnxNAS
server string = %h
wins support = no
dns proxy = no
security = user
encrypt passwords = yes
panic action = /usr/share/samba/panic-action %d

[homes]
comment = Home Directories

[Video]
path = /data/eric/Videos

[Music]
path = /data/eric/Music

[Pictures]
path = /data/eric/Pictures

[data]
path = /data
writeable = Yes

my ls -l of /data/eric/Pictures

drwxrwxrwx 2 ericfoss root     4096 2011-03-13 22:09 Android Projs
drwxrwxrwx 3 ericfoss root     4096 2011-03-13 22:09 Automotive
-rwxrwxrwx 1 ericfoss root     2439 2010-12-17 17:03 BDD reduction.png
-rwxrwxrwx 1 ericfoss root     2722 2010-12-17 16:55 BDD Tree.png
-rwxrwxrwx 1 ericfoss root     7341 2010-12-17 16:46 BDD Tree.xcf
-rwxrwxrwx 1 ericfoss root    72421 2007-11-22 22:59 Bum Ninja.jpg
-rwxrwxrwx 1 ericfoss root    32152 2010-12-17 21:25 cell transition.png
-rwxrwxrwx 1 ericfoss root    40212 2010-12-17 17:55 control graph.png
drwxrwxrwx 2 ericfoss root     4096 2011-03-13 22:09 Crap
-rwxrwxrwx 1 ericfoss root       82 2010-09-20 17:18 desktop.ini
ericfoss@SERVER:~$

Output from samba4 restart

sudo /etc/init.d/samba4 restart
 * Stopping Samba 4 daemon samba              [ OK ]
 * Starting Samba 4 daemon samba
Unknown parameter encountered: "guest ok"
Ignoring unknown parameter "guest ok"
Unknown parameter encountered: "guest ok"
Ignoring unknown parameter "guest ok"
Unknown parameter encountered: "writeable"
Ignoring unknown parameter "writeable"
Unknown parameter encountered: "valid users"
Ignoring unknown parameter "valid users"
                                              [ OK ]

I can't delete, rename or create files...

0

4 Answers 4

21

Samba has its own layer of access control for each share. There are two basic options

  • read only: by default every share is read-only, regardless of filesystem permissions,
  • writeable: in order to allow write access you should set writeable = Yes.

This should be enough to solve the problem. But if you'd like to learn more about Samba permissions, like how to set umask, enable guest account or control access for individual users/groups, then read the short tutorial on Samba permissions.

3
  • Problem is that my smb.conf isn't responding the same as the expected output... see my question update Mar 20, 2011 at 22:49
  • Could you explain to me why my settings don't take affect till I restart? (Yes, I know about sudo /etc/init.d/samba4 restart) Mar 22, 2011 at 5:17
  • write permissons like 0774 are not set in Samba! The limit is value UMASK in file /etc/login.defs ! Group write rights in Samba and NFS are not able to superseed the default rights in the /etc/login.defs UMASK. Put 002 instead of 022 and you're done. May 22, 2020 at 17:20
6

I just had same problem as OP. Samba config was set up correctly but still I could not write files.

My problem was that directory i wanted to share was created by root user so i had to chown that directory to my normal user and everything is working fine. I can create /delete and /modify files and folders now.

5

Since you don't seem to need Active Directory integration, you're probably better off installing Samba 3 (in the "samba" package) rather than Samba 4, which has not been released yet.

"writeable = yes" is an alias for "read only = no" in Samba 3. The alias has been removed in Samba 4.

1
  • 1
    Just a note to future readers: the above information was correct in the past, but is outdated. Samba 4 now supports "writeable=yes" (I am using Samba 4.3.11, and it works fine).
    – blendenzo
    Dec 27, 2016 at 19:46
1

If writeable, read only, write list are correctly configured, there might be a ownership problem of the directory for samba sharing.

ex) [sambashare] comment = Samba on Ubuntu path = /mnt/storage read only = no browsable = yes

/mnt/storage folder's ownership is root:root. To write something to this directory, you must change the ownership to alice:root or alice:alice, where alice is a samba account.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .