1

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.

5 Answers 5

3

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

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

1
  • Sorry, no, the -p option preserves creation times and modes, not file permissions. Apr 24, 2014 at 23:57
2

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
2

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

1

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.

1
  • @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, 2010 at 16:45
0

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

1
  • thanks for response but i cant :(. we have same thing working in many env and I cant change it.
    – Hemant
    Aug 5, 2010 at 16:45

You must log in to answer this question.