If I was to chmod 777 blah.sh on server A and then move it to server B, would it retain the permissions, or would it default to some other permissions once it hit server B?

migrated from stackoverflow.com Apr 3 '11 at 22:21

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


That depends entirely and completely on the method of transfer.

rsync will preserve permissions with -p, ownership with -o (using numeric id only if you pass --numeric-ids). -a combines -rlopt, unless you negate it with --no-o or --no-p.

scp will not normally preserve permissions, but will if you pass -p.

cp has roughly the same flags (-p for permissions, -a for everything and recursing).

tar has the -p flag as well.

cpio will always preserve permissions.

  • Note that ftp will not, by default -- unless the FTP client you're using explicitly sets the permissions after uploading, most FTP daemons apply a default umask to uploaded files. – Shadur Apr 4 '11 at 7:29

No it won't since the permissions are attached to users.

However it only takes a simple command to chmod a file so just move it and set the permissions.

  • 1
    permissions are attached to whom? – sehe Apr 3 '11 at 21:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.