24

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?

2 Answers 2

23

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.

3
  • 2
    That does not work: lp_bool(guest nobody): value is not boolean!
    – reox
    Mar 22, 2016 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.
    – user311189
    Oct 28, 2016 at 5:22
  • 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, 2017 at 21:04
10

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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