25

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?

yannisf
  • 351
  • 1
  • 3
  • 5

2 Answers2

25

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.

Charles Green
  • 20,952
  • 21
  • 60
  • 92
Panther
  • 100,877
  • 19
  • 193
  • 283
  • 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. –  Oct 28 '16 at 05: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 '17 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
Jakuje
  • 6,505
  • 7
  • 30
  • 37
Lance C.
  • 101
  • 1
  • 3