Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

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

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

    
File permissions are stored in inodes. –  Matt Ball Apr 3 '11 at 21:11

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
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.

share|improve this answer
1  
permissions are attached to whom? –  sehe Apr 3 '11 at 21:12

Your Answer

 
discard

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

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