Score:0

Cannot write to cifs share with SMB/Samba between 2 linux machines

mx flag

As user1 (primary group root) on server1 (Linux) I am able to write files to /tmp.

The permissions are:

drwxrwxrwt  19 root              root  4096 Jan  3 11:04 ./

When I mount (cifs) server1 using usern=user1 on server2 (Linux) I am unable to write any files.

user2@server2$ echo hello >> /mnt/server1/tmp/foo
-bash: /mnt/server2/tmp/foo: Permission denied

However, I am able to write files from a Windows client when I connect with user1!

/etc/samba/smb.conf on server1

[root]
        comment = Root
        available = yes
        path = /
        write list = root user1 @root
        read only = no
        browsable = yes
        public = yes
        writable = yes

/etc/fstab on server2

//server1/root    /mnt/server1   cifs    user=user1,password=***,dir_mode=0770,file_mode=0770,nounix    ,uid=0,gid=0,forceuid,forcegid

I have tried with/without the uid=0,gid=0,forceuid,forcegid options as well as the mode and nounix options.

From server2I can list files in /mnt/server1/tmp and see files I created locally on server1. I don't see any permissions errors in the logs /var/log/*.

Where/how can I diagnose the issue?


UPDATE

I am able to write to the share from server2 as root. This is really strange as I would think server1 would not trust that root from server2 is the same root on server1.

in flag
Why `uid=0,gid=0`? This would not enforce a valid user account. Have you tried passing credentials in the mount statement?
mx flag
It was a blind attempt - the result is the same without this setting.
mx flag
As a workaround (which works) I put `forceuser=user1` in the smb.conf but this is not really what I want.
Score:0
cn flag

This should be solvable by providing the owner of the share in the mount command. Try options :

uid=user1,gid=user1,username=user1
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.