Is it possible to have a samba share read only for guests, and read write for authenticated users?

If I put guest ok on an share then I am not prompted for a password, and effectively logged as guest with read only rights. But I want to be authenticated so that I can also write.

Could anyone provide a sample smb share stanza to achieve this?

share|improve this question

Edit /etc/samba/smb.conf

# command line
sudo -e /etc/samba/smb.conf

# graphical
gksu gedit /etc/samba/smb.conf

Add in the write list paramter to your share definition, add in your list of users allowed write access.

write list = user1 user2 user3

You can use read list as well

read list = guest, nobody

So ...

[share]
comment = Ubuntu Share
path = /your/samba/share
browsable = yes
guest ok = yes
read only = yes
write list = user1 user2 user3
create mask = 0755

If you need finer grain of control, you can use acl (access control lists) on the server.

share|improve this answer
2  
That does not work: lp_bool(guest nobody): value is not boolean! – reox Mar 22 '16 at 11:00
1  
this answer is wrong. read only can be only yes or no, can't have usernames or groups as its value. – sdkks Oct 28 '16 at 5:22
    
Works like a charm!! Thanks :) – Kiril Aleksandrov Dec 10 '16 at 6:54
    
I tried setting read only to guest nobody as suggested, but all it did was remove guest access to my share altogether, as if guest ok had been no. Using write list worked like a charm, just a shame I'll have to update it for every new user I add. – Hubro Oct 14 '17 at 21:04

Read only parameter is a Boolean value, so this should be more like one of the following:

[share]
comment = Ubuntu Share
path = /your/samba/share
browsable = yes
guest ok = yes
read only = no
read list = guest nobody
write list = user1 user2 user3
create mask = 0755

[share]
comment = Ubuntu Share
path = /your/samba/share
browsable = yes
guest ok = yes
read only = yes
write list = user1 user2 user3
create mask = 0755
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.