Skip to main content
deleted 2 characters in body
Source Link
Jez
  • 1k
  • 3
  • 18
  • 37

I've created a new Samba instance and it works, but when I copy new files onto the Samba share they get created with the owner:group as root:myuser. All the files that I create on Linux itself have myuser:myuser. Why does Samba set root as the owner? I'm aware of the force user and force group options but I'd rather not use them as it seems they apply globally to all configured Samba shares; if I had 2 shares set up with 2 different users, I would want the files to be created with those respective users as the owner and group, and root shouldn't be owner or group for anything.

The relevant configsmb.conf is:

[global]
 
# Make Samba follow symlinks
follow symlinks = yes
wide links = yes
unix extensions = no

# Custom shares
[myuserhome]
path=/home/myuser
browseable=yes
writeable=yes
create mask = 0664
directory mask = 0755
valid users = myuser
admin users = myuser

I've created a new Samba instance and it works, but when I copy new files onto the Samba share they get created with the owner:group as root:myuser. All the files that I create on Linux itself have myuser:myuser. Why does Samba set root as the owner? I'm aware of the force user and force group options but I'd rather not use them as it seems they apply globally to all configured Samba shares; if I had 2 shares set up with 2 different users, I would want the files to be created with those respective users as the owner and group, and root shouldn't be owner or group for anything.

The relevant config is:

[global]
 
# Make Samba follow symlinks
follow symlinks = yes
wide links = yes
unix extensions = no

# Custom shares
[myuserhome]
path=/home/myuser
browseable=yes
writeable=yes
create mask = 0664
directory mask = 0755
valid users = myuser
admin users = myuser

I've created a new Samba instance and it works, but when I copy new files onto the Samba share they get created with the owner:group as root:myuser. All the files that I create on Linux itself have myuser:myuser. Why does Samba set root as the owner? I'm aware of the force user and force group options but I'd rather not use them as it seems they apply globally to all configured Samba shares; if I had 2 shares set up with 2 different users, I would want the files to be created with those respective users as the owner and group, and root shouldn't be owner or group for anything.

The relevant smb.conf is:

[global]
# Make Samba follow symlinks
follow symlinks = yes
wide links = yes
unix extensions = no

# Custom shares
[myuserhome]
path=/home/myuser
browseable=yes
writeable=yes
create mask = 0664
directory mask = 0755
valid users = myuser
admin users = myuser
Source Link
Jez
  • 1k
  • 3
  • 18
  • 37

Why does Samba create all new files/directories with 'root' as the owner?

I've created a new Samba instance and it works, but when I copy new files onto the Samba share they get created with the owner:group as root:myuser. All the files that I create on Linux itself have myuser:myuser. Why does Samba set root as the owner? I'm aware of the force user and force group options but I'd rather not use them as it seems they apply globally to all configured Samba shares; if I had 2 shares set up with 2 different users, I would want the files to be created with those respective users as the owner and group, and root shouldn't be owner or group for anything.

The relevant config is:

[global]

# Make Samba follow symlinks
follow symlinks = yes
wide links = yes
unix extensions = no

# Custom shares
[myuserhome]
path=/home/myuser
browseable=yes
writeable=yes
create mask = 0664
directory mask = 0755
valid users = myuser
admin users = myuser