# CIFS chown Permission Denied

## s1n

I've been trying for some time to figure out my SMB/CIFS problem and have met with no success. I want to setup some portage related space on a samba share and am getting permission denied when I attempt to chown a file. Both the client and the server run linux with SMB and CIFS support built in:

```
CONFIG_CIFS=y

CONFIG_CIFS_STATS=y

# CONFIG_CIFS_STATS2 is not set

# CONFIG_CIFS_WEAK_PW_HASH is not set

CONFIG_CIFS_XATTR=y

CONFIG_CIFS_POSIX=y

# CONFIG_CIFS_DEBUG2 is not set

# CONFIG_CIFS_EXPERIMENTAL is not set

CONFIG_SMB_FS=y

# CONFIG_SMB_NLS_DEFAULT is not set

```

That is the same in both kernel configurations. The server is using the following configuration for a test share:

```
workgroup = HELLKEEP

netbios name = erebus

encrypt passwords = yes

[sata160]

path = /mnt/sata160

public = yes

writable = yes

read only = no

browseable = yes
```

When I mount this share on my client machine, I use the following command:

```
mount.cifs //erebus/sata160 /mnt/erebus/onesixty/ -ouser,credentials=/etc/samba/credentials,rw
```

Now this will successfully mount the share. I can read and write files and directories. I can even chmod files. However, no matter what I try, I cannot seem to chown a file to a different user. By that I mean that i get a "Permission Denied." The only thing in any log file I could find relating to these actions is the connect message:

```
  ***.***.***.*** (***.***.***.***) connect to service sata160 initially as user *** (uid=1001, gid=100) (pid 6614)
```

When I do this from the command-line as root, the user that shows on all the files is the UID, not the username, even if I provide a "user=,gid=" option to the mount command. But when this is done from the fstab, it works as expected. This user is local to each machine (not ldap or acl) and have the same UID on both machines.

I was recommended to switch to CIFS since SMB is deprecated and on its death bed. I desperately want this to work because I need to use my network storage for my PORTAGE_TMPDIR.

----------

## Jake

I would start by including "unix extensions = Yes" under "[global]" in smb.conf, and ensuring that the Samba user has UNIX permissions to modify the shared files/directory. Oh, and you'll most likely need "case sensitive = yes" to use a Samba share for PORTAGE_TMPDIR.

----------

## s1n

I did that; I added those options. The Samba user is able to modify files, delete files, create files, change directories, get directory listings, with the exception of changing permission.

I did notice that when I mount as smbfs, it had the samba user name as owner of the files, but if I mounted with cifs, the username was the UID of the user.

It still does not work with either SMBFS or CIFS.

----------

## Jake

Is there any particular reason you're using Samba/CIFS rather than NFS?

----------

## s1n

I don't think this matters, but I'm using it because I have a mixed environment.

----------

## s1n

Bump this. 

I still can't chown files regardless of what I do. Anyone have any tips?

----------

## Jake

I'm not even sure CIFS supports this. I get the same error, by the way. Seriously, if you're just sharing media files, CIFS works great. If you need full POSIX support, use NFS. You don't really want to share PORTAGE_TMPDIR with Windows anyway, right?

----------

## thecooptoo

I am not an expert but IIRC chowning file ownership is a concept foreign to windows and it just doesnt work. cant remember what the workaround was im afraid ( it was on the forums but ages ago ) Sorry

----------

## Jake

Windows uses NT ACLs, which Samba supports via extended attributes.

----------

## s1n

Well, right now, I don't need to change ownership of files from a Windows machine just yet. However, the linux machines that access certain shares do need that capability.

Would ACL support fix this problem or would that be overkill?

----------

## Jake

NFS is the way to go for the Linux clients.

----------

## s1n

So you're saying there is no way to do this with SMB/CIFS?

Can anyone else vouch this claim?

----------

