I have a server which I want to use to share files on a local network. Each user should have a own directory for himself as well as several shared directories:

FolderUser1 ... FolderUserN and SharedFolder1 ... SharedFolderN

Current folder permission:

drwxr-xr-x  2 admin admin  4096 2012-01-10 13:58 FolderUser1
drwxr-xr-x  2 admin admin  4096 2012-01-10 14:01 SharedFolder1


comment= FolderUser1 network dirctory
path = /home/admin/FolderUser1
valid users = User1
browsable= yes
public = no
writable = yes

Now I would like to now which file permissions have to be set in on the server for the actual folders and which permissions have to be set in smb.conf configuration file, so that there are no permission conflicts. At the moment the clients can't write to there personal folders and get an error: Permission denied


Your smb.conf looks fine, though the shared folders should be specified as public. I think you need to change the folder ownership on the server though. For example:

drwxr-xr-x  2 admin admin  4096 2012-01-10 13:58 FolderUser1

Should be:

drwxr-xr-x  2 User1 User1(check)  4096 2012-01-10 13:58 FolderUser1

Check the user's default group and use that, it may be different to the username, depending on your setup. Assuming the folders are owned by the correct users then your current permissions (755) should be fine.

Samba should prevent other user's from accessing the private folders despite them having read permissions on server as long as you specify this in smb.conf. Of course any user with regular access to the server will still be able to access these folders, so feel free to tighten up permissions for any folders you want to keep more private, I'm not sure on your exact user setup.

Check man chown for details on changing file/dir ownerships:

Read more at the Linux Man pages.

  • That did the trick! Thanks a lot! And +1 for the detail! – wowpatrick Jan 13 '12 at 15:13
  • Just one short addition: What folder permissions do I have to set if I have more than one user listed in the valid users directive? – wowpatrick Jan 13 '12 at 16:01
  • 1
    Take a look here: oreilly.com/openbook/samba/book/ch06_01.html#ch06-92902group valid users can use group names as well as usernames. In this case all users intended for a folder would need to be a member of the relevant group. – Breadbin Jan 16 '12 at 15:39

How is the authentication handled at the moment?

Samba will attempt to impersonate some user after authentication as opposed operating files as root. See the "security modes" defined in Samba's documentation.

If you're using LDAP or ADS, you'll need to look into idmap: Concept and idmap module manpages.

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.