samba share from Ubuntu VM fails with 'force user'

7,956

I stumbled across this answer on ServerFault which gave me the clue that I needed to add 'root' to the list of valid users.

The two shares which previous weren't working, now are. I added 'www-data' and 'root' respectively next to the 'valid users':

[sites]
path = /home/username/sites
available = yes
valid users = username,www-data
read only = no
browseable = yes
public = yes
writable = yes
force user = www-data
force group = www-data
create mask = 0644
directory mask = 0755
hide dot files = no
follow symlinks = no
;wide links = no

[etc]
path = /etc
available = yes
valid users = username,root
#guest ok = yes
#guest only = yes
read only = no
browseable = yes
public = yes
writable = yes
force user = root
force group = root
create mask = 0644
directory mask = 0755
hide dot files = no
follow symlinks = no

Anyways. This answer is for anyone else who might stumble across the same problem. (No, I have no idea why it used to work, but broke on upgrade)

Share:
7,956

Related videos on Youtube

cmroanirgo
Author by

cmroanirgo

I'm so old, I'm retired from development.

Updated on September 18, 2022

Comments

  • cmroanirgo
    cmroanirgo over 1 year

    I have two ubuntu VM's (server running in VirtualBox, as development machines). The older box (ubuntu 12.04 LTS) is running samba just fine and all shares work well. When making a new machine, I copied the share information (but not the whole config file), to a new box (ubuntu 14.04 LTS), but many of the shares aren't working.

    This share IS working on old and new:

    [username]
    path = /home/username
    available = yes
    valid users = username
    read only = no
    browseable = yes
    public = yes
    writable = yes
    force user = username
    force group = username
    create mask = 0644
    directory mask = 0755
    hide dot files = no
    follow symlinks = no
    

    This share fails on the newer ubuntu 14.04 LTS (It's the same as above, but different 'force user/group':

    [etc]
    path = /etc
    available = yes
    valid users = username
    read only = no
    browseable = yes
    public = yes
    writable = yes
    force user = root
    force group = root
    create mask = 0644
    directory mask = 0755
    hide dot files = no
    follow symlinks = no
    

    I have other shares that I 'force user = www-data' in a similar manner that also fail.

    What I see (from osx) when I try to connect is: "The operation can’t be completed because the original item for “etc” can’t be found." (I have no windows boxes to test with).

    PS: The smb.conf is basically 'vanilla' otherwise: I have made no edits outside the shares themselves.

    I have had a quick look at the logs, and the only thing that seems to get logged is in log.workstation:

    [2014/07/27 09:02:06.173271,  0] ../source3/param/loadparm.c:4094(check_usershare_stat)
      check_usershare_stat: file /var/lib/samba/usershares/ owned by uid 0 is not a regular file
    

    Any help in working out where to start solving this would be appreciated. Obviously, it has something to do with the 'force user' and 'force group'...but apart from that I don't know where to look.

    • Admin
      Admin over 9 years
      Thanks for posting this! I was struggling with a similar problem and this led me straight to double checking my group permissions. Lo and behold! A quick adjustment to group permissions and I'm up and running.