Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

we are trying to copy files from one server to another but the permissions of copied files are not correct. I have tried following solution but its not working.

currently permission is set to : -rw------- We want to change the permissions to -rw-rw-r—

Any one faced this issue ?

EDIT: We have Unix on both the sides.

share|improve this question

migrated from Aug 6 '10 at 1:37

This question came from our site for professional and enthusiast programmers.

Use the "-p" flag to preserve permissions when copying with SCP.


share|improve this answer
Sorry, no, the -p option preserves creation times and modes, not file permissions. – Daniel Rodriguez Apr 24 '14 at 23:57

Check your umask on the remote side. I'll bet it looks like 077.

share|improve this answer

I've set this with a chmod after the copy.

scp /path/to/file server:/path/to/file
ssh server chmod 664 /path/to/file
share|improve this answer

If you run WinSCP, there's an option set perms after the upload. Other than that, I believe that the only thing you can do is to chmod after the upload.

share|improve this answer
@NinjaCat: actually same thing is working in many other production env. I don't know why in that env its not working. – Hemant Aug 5 '10 at 16:45

You could try something more advanced like rsync, perhaps it has the needed options.

share|improve this answer
thanks for response but i cant :(. we have same thing working in many env and I cant change it. – Hemant Aug 5 '10 at 16:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.