scp creates undesired file permissions

I'm trying to copy files from a remote linux system (on which I am not the super user) to my own local system, using the scp command on Ubuntu 16.04 LTS.

scp remote_username@remote-host:/path-to-remote-file local-copy

On the man page of scp, it states that the -p option causes scp to preserve the permission bits of the remote file. This would seem to imply that the remote file's permission bits would not be preserved without the -p option, but there is no other option to negate it.

I want the permissions of the newly created copies of the files on my local system to respect my local user's umask settings, but instead, scp always copies the permissions of the remote files, regardless of whether -p is used or not.

In other words, is there an equivalent to cp's --no-preserve=mode for scp?

1 Answer

scp creates files with the owner of the user and groups of the user running the command on the destination machine. To keep the owner rights, you should use rsync. For more info Here.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like