SFTP: Folders copied from remote to a local NFS folder will have the uid/gid set to the remote uid/gid and not the local uid/gid
mrosenstihl opened this issue · 0 comments
Distribution
Debian GNU/Linux 12 (bookworm)
Package version
5.6.4-1
Frequency
Always
Bug description
When using the SFTP protocol to copy a remote folder to a local folder (on NFS) the owner and group of the folder and files will be the remote owner and group. The local home folder is on an NFS file share.
The bug does not occur on a regular local non-NFS folder! There, the permissions are correct.
Steps to reproduce
- Local host: user1 , uid=10000, gid=8000, /autohome/user1 folder is on NFSv4
- Remote host: user2, uid=1001, gid=1001
- In the location bar on the local host enter the remote connection: sftp://user1@user2.remote.host
- Drag a folder (for example "data" ) to /autohome/user1/Desktop on the local host
- I can not remove the folder, I get an error message: "Unable to trash file /autohome/user1/Desktop/data: Permission denied"
- Check permissions and I see uid=1001 and gid=1001
Expected behavior
Permissions of the local ~/Desktop/data folder should be uid=10000, gid=8000
Additional information
The bug does not occur on a regular local non-NFS folder! There the permissions are correct.
The bug does also not occur with:
- nautilus
- thunar
- dolphin
- terminal: scp -r
Server
The local home folder /autohome/user1 is mounted from a NAS running TrueNAS Scale:
TrueNAS Scale 22.12.4.2 @1708081940
Operating system type: Linux
Operating system release: 5.15.131+truenas
NFS server kernel version:
root@nas[
]# uname -a]# modinfo nfsd
Linux nas 5.15.131+truenas #1 SMP Fri Oct 13 19:46:10 UTC 2023 x86_64 GNU/Linux
root@nas[
filename: /lib/modules/5.15.131+truenas/kernel/fs/nfsd/nfsd.ko
license: GPL
author: Olaf Kirch okir@monad.swb.de
alias: fs-nfsd
depends: auth_rpcgss,sunrpc,grace,lockd,nfs_acl
retpoline: Y
intree: Y
name: nfsd
vermagic: 5.15.131+truenas SMP mod_unload modversions
parm: cltrack_prog:Path to the nfsdcltrack upcall program (string)
parm: cltrack_legacy_disable:Disable legacy recoverydir conversion. Default: false (bool)
parm: nfs4_disable_idmapping:Turn off server's NFSv4 idmapping when using 'sec=sys' (bool)
parm: inter_copy_offload_enable:Enable inter server to server copy offload. Default: false (bool)
Client
Mount entry on the client:
192.168.8.1:/mnt/home/user1 on /autohome/user1 type nfs4 (rw,nosuid,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.8.2,local_lock=none,addr=192.168.8.1)
Kernel:
Linux myhostname 6.5.0-0.deb12.4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.10-1~bpo12+1 (2023-11-23) x86_64 GNU/Linux