I was struggling to find a good place to put this one, should it go in the Linux forums, should it go in the Windows forums? Anyway, networking seemed like as good a place as any so here goes:

I'm currently setting up a SAMBA file server which I am planning to use for backups. The problem is, the moment I try and restrict access to a folder it locks me out completely, I shall post my smbd.conf file to show you what I mean:

[global]

    workgroup = WORKGROUP
    security = user

[PublicFiles]

    comment = Public File Shares
    path = /home/FileShares/Public
    browsable = yes
    guest ok = yes
    read only = no
    writeable = yes
    create mask = 0755

[Alexander]

    comment = File Shares for Alexander
    path = /home/FileShares/Alexander
    browsable = yes
    valid users = alexander
    guest ok = no
    read only = no
    writeable = yes
    create mask = 0755

I can connect to the PublicFiles share and view content in the folder, however if I try to connect to the share 'Alexander' it won't allow me and gives the error "Access Denied". The same thing happens if I try to modify or add a file to the PublicShares. I have setup a SAMBA user, and the password is correct however I don't know what I am doing wrong.

It is an Ubuntu 12.04 server, trying to connect to it with Windows 7

Any suggestions or help would be appreciated.

Thanks

Dani AI

Generated

Good catch, — the behaviour you saw is exactly why Samba troubleshooting always starts with the underlying Linux filesystem. Samba enforces share- and user-level rules, but the kernel enforces file ownership, mode bits and ACLs. If the Unix permissions deny access, the client will see “Access Denied” even when the Samba share looks correct.

Quick, practical checklist to reproduce and fix the usual issues:

ls -ld /home/FileShares/Alexander
getfacl /home/FileShares/Alexander   # shows ACLs if in use
sudo chown -R alexander:alexander /home/FileShares/Alexander
sudo chmod -R 750 /home/FileShares/Alexander

What to look for: the ls -ld line shows owner:group and rwx bits. If the owner is root or another user the Samba account won’t be able to write. Use getfacl when ACLs are used (they override mode bits).

Samba-specific checks to run on the server:

testparm -s                 # validate smb.conf
pdbedit -L                  # list samba users
smbclient //localhost/Alexander -U alexander   # try authenticating locally
tail -f /var/log/samba/log.*               # watch permission errors

Other common causes and tips: Windows often caches credentials — clear with Control Panel → Credential Manager or net use \\server\share /delete. If the share is on an NTFS/FAT partition, permissions are handled by mount options (uid,gid,fmask,dmask) — check /etc/fstab. On Ubuntu, AppArmor or filesystem ACLs can also block access. For multi-user shares consider using group ownership with force group, inherit permissions = yes, and sensible masks (create mask = 0644, directory mask = 0755) so new files get the expected permissions.

Your fix was the right one; these checks help catch less obvious problems and make the setup robust for other users.

Ok, sorted it out.

Although SAMBA was running with the correct permissions, I hadn't adjusted the Linux folder permissions which take priority over those of SAMBA and therefore cancelled them out.

Solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.