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.

My scp doesn't respect umask setting of the user it's sending files to. Is there a setting somewhere or should I use a different solution?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

The umask, in the way you mean it, is a property of the login shell. It is set in .profile or one of its relatives. Since scp doesn't log in interactively, it doesn't run any of these scripts, so it doesn't get the umask setting you've defined there.

The closest thing I can think of to what you want is to set the permissions appropriately on the file locally, then use the -p option to scp to preserve the file modes.

You might also find rsync helpful. If you use its -a option, it will preserve almost all attributes of a file when copying, including permissions and modes.

share|improve this answer
add comment

According to this answer over on ServerFault it looks like the best way to make this happen is to introduce pam_umask into the target systems authentication sequence.

share|improve this answer
    
I want it to be set only for a specific user on the target system. –  Tshepang Jul 19 '11 at 15:03
add comment

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.