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.

http://linuxshellaccount.blogspot.com/2007/11/setting-basic-file-permissions-in-non.html

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.

link|improve this question
feedback

migrated from stackoverflow.com Aug 6 '10 at 1:37

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

5 Answers

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

Source: http://amath.colorado.edu/computing/software/man/scp.html

link|improve this answer
feedback

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

link|improve this answer
feedback

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.

link|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
feedback

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

link|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
feedback

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
link|improve this answer
feedback

Your Answer

 
or
required, but never shown