# Read only samba share after upgrade

## tabanus

I use samba on a gentoo server to share some directories to a couple of Ubuntu clients. Since the upgrade to samba-4.2.9 I'm having trouble connecting with write permissions.

I can mount the folders as an anonymous user, but not via the command line

In the Ubuntu fstab I have:

```
//192.168.0.5/public   /mnt/con1    cifs    auto,username=guest
```

Issuing the command: 'mount /mnt/con1' I get this error:

```
mount: //192/168.0.5/public is write-protected, mounting read-only

mount: cannot mount //192.168.0.5/public read-only
```

/etc/smb.conf on the server:

```

[global]

   workgroup = SURGERY

   server string = Samba

hosts allow = 192.168.0.0/255.255.255.0

log file = /var/log/smb/samba.%m

   max log size = 50

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

printcap name = cups

disable spoolss = Yes

show add printer wizard = No

printing = cups

dos charset = 850

unix charset = UTF-8

[public]

        comment = shared

        path = /mnt/Shared/Data

        guest ok = yes

        browseable = yes

        writeable = yes

        force user = Staff

        force group = users

        wide links = yes

[printers]

        comment = All Printers

        path = /var/spool/samba

        printer admin = root, local_user

        create mask = 0600

        guest ok = Yes

        printable = Yes

        use client driver = Yes

        browseable = No

[DICOM]

        comment = shared

        path = /mnt/vault/DICOM

        guest ok = yes

        browseable = yes

        writable = yes

        force user = Staff

        force group = users

        wide links = yes

```

Before the upgrade, I mounted this in fstab with this command:

```
//192.168.0.5/public   /mnt/con1   cifs    auto,username=Staff,password=123
```

Unfortunately that no longer works either, hence trying to get it to work as a guest.

----------

## gerdesj

There is almost certainly another change apart from the version upgrade.  Anyway, assuming you want to go back to using your Staff user:

Ensure the Staff password is set correctly (pdbedit or whatever)

Fix up permissions on the share

#chown -Rvf Staff:users /mnt/Shared/Data

#chmod -Rvf u=rwx,g=rxs,o= /mnt/Shared/Data

You could instead use "find -type d -exec chmod ..." to do the g=rxs bit instead so that only directories get the s bit.  It will ensure that future files get the "users" group.

In smb.conf:

[public] 

        comment = shared 

        path = /mnt/Shared/Data 

        guest ok = NO

        browseable = yes 

        writeable = yes 

        force user = Staff 

        force group = users 

        wide links = yes 

Samba works just like Windows albeit with a lot more flexibility.  The share defines in smb.conf are near enough equivalent to the shares in Windows but you must also get the file system permissions correct as well. 

guest ok = yes is rarely what you want, especially for user data.

Cheers

Jon

----------

## tabanus

Thanks for the suggestions, but it didn't work.

For now I've rolled back to samba-3.6.25, and everything's working OK again.

----------

