Brendan Moloney
2010-Jul-07 01:28 UTC
scp forces original access permissions when owner lacks write access
Hello, I am not sure if this is a bug or a feature... When I use scp to copy a file to a filesystem which forces or masks permissions on new files (in my case a samba share) the resulting permissions depend on whether the owner had write access in the original permissions. If the owner did have write access then the copied file ends up with the permissions specified by the filesystem. If the owner did not have write access then scp performs a chmod command after copying the data so that the copied file ends up with the original permissions. For example if I have mounted /samba_share which masks new file permissions with 440 on the machine remote_machine: $ touch testfile1 testfile2 $ chmod u-w testfile2 $ ls -l -rw-r--r-- 1 someuser somegroup 0 Jul 6 18:04 testfile1 -r--r--r-- 1 someuser somegroup 0 Jul 6 18:04 testfile2 $ scp testfile* remote_machine:/samba_share $ ssh remote_machine 'ls -l /samba_share' -r--r----- 1 someuser somegroup 0 Jul 6 18:10 testfile1 -r--r--r-- 1 someuser somegroup 0 Jul 6 18:10 testfile2 It seems like the permissions should only be preserved if the -p flag is used. However I am not sure if there is some other case where this is the desired behavior. Thanks for your time, Brendan Moloney
Apparently Analagous Threads
- Force destination files to specific owner/group
- behavior of ALU Scheduler
- DO NOT REPLY [Bug 4220] New: --backup causes "stat" failed message when trying to delete a directory
- Inconsistent behavior using 3.1.2 from macOS 10.12.2 to an AFP mount
- Inconsistent behavior using 3.1.2 from macOS 10.12.2 to an AFP mount