3

I'm trying to configure Samba running on Gentoo Linux to share my external NTFS drive with two other machines, one running Gentoo as well and the other running Windows 7. Previously this drive was connected to a Samba-enabled router (Zyxel Keenetic Giga II) and I could connect to it using the login/pass pair specified in the web interface. I had both read and write access.

Now I'm trying to configure Samba to allow anyone who specifies the valid login/pass pair to have full access. The login/pass are unique (I do not use that username anywhere else).

I managed to connect both Linux and Windows machines, but only in read-only mode. I get Permission denied on all attempts to write, even though the permissions from ls show that I should be able to write.

The network structure is:

  • sambaserv: Samba server hostname
    • sambauser/sambapass: Samba login credentials
    • myuserserv: my user login
  • linuxclient: Linux client hostname
    • myuserclient: my user login
  • winclient: Win 7 client hostname


Here's what I have done:

sambaserv: ls -l /mnt

...
drwxrwxr-x 1 myuserserv myuserserv 4096  2 June  01:08 storage

sambaserv: /etc/fstab

/dev/sdc1    /mnt/storage    ntfs-3g    defaults,uid=1000,gid=1000,umask=0002,noatime 0 0

Here 1000 is the ID of myuserserv. I'd like to use this drive for purposes other than Samba sharing, so I didn't specify sambauser instead.


sambaserv: Created sambauser by issuing these commands:

useradd sambauser
passwd sambauser
pdbedit -a -u sambauser

sambaserv: testparm

$ sudo testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[storage]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        server string = sambaserv
        log file = /var/log/samba/log.%m
        max log size = 50
        dns proxy = No
        idmap config * : backend = tdb
        hosts allow = 192.168.1., 127.

[storage]
        comment = Storage
        path = /mnt/storage
        valid users = sambauser
        read only = No
        create mask = 0775
        directory mask = 0775

I have no idea how file permissions are handled considering that the drive is NTFS, but these would be okay if it wasn't.


linuxclient: ls -l /mnt

...
drwxrwxr-x 1 myuserclient myuserclient  0  2 juin  01:08 storage

linuxclient: /etc/fstab

//sambaserv/storage    /mnt/storage    cifs    credentials=/home/myuserclient/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

winclient: Typed the sambauser/sambapass pair in Connect network drive under My Computer.


How do I get write access under Linux and Windows?

0

File and share permissions are not related to each other and you need to set them individually. You need a line such as this in smb.conf to allow write access to the share:

write list = sambauser

See smb.conf man page for the details.

  • Doesn't work for me. However, what does work (as I have just discovered) is adding sambauser to the group of myuserserv (and restarting Samba daemon). – Pastafarianist Jun 2 '15 at 15:20
0

I have been pointed to a solution (not the solution). If I add sambauser to the group of myusersrv on sambaserv, the problem goes away. However, this is not a good solution, because it requires messing with user groups, which I might not have been able to do in a different environment.

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.