Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

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.

share|improve this question

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

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

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

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

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

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

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

 
discard

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