[Bug 3925] New: scp may modify permissions of target directory

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Wed Feb 18 04:56:36 AEDT 2026


https://bugzilla.mindrot.org/show_bug.cgi?id=3925

            Bug ID: 3925
           Summary: scp may modify permissions of target directory
           Product: Portable OpenSSH
           Version: 10.2p1
          Hardware: amd64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: scp
          Assignee: unassigned-bugs at mindrot.org
          Reporter: sunny at sny.sh

When running scp with "-r .", it modifies the file system permissions
of the target directory.

For example:

$ ssh debian.local ls -ld directory
drwx------ 2 sunny sunny 4096 Feb 17 18:13 directory
$ scp -r . debian.local:directory
file     100%    0     0.0KB/s   00:00
$ ssh debian.local ls -ld directory
drwxr-xr-x 2 sunny sunny 4096 Feb 17 18:13 directory

This does not happen when doing something like "scp *" instead:

$ ssh debian.local ls -ld directory
drwx------ 2 sunny sunny 4096 Feb 17 18:13 directory
$ scp * debian.local:directory
file     100%    0     0.0KB/s   00:00
$ ssh debian.local ls -ld directory
drwx------ 2 sunny sunny 4096 Feb 17 18:13 directory

This also doesn't happen when using scp to copy files locally (i. e.
"scp -r . /some/other/directory").

Tested with OpenSSH 10.2p1 on the client (from the Arch repositories)
and 10.0p1 on the server (from the Debian repositories), as well as the
other way around.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list