How to grant write permissions in Samba?
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...
Solution 1:
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 setwriteable = 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.
Solution 2:
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.
Solution 3:
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.