scp/sftp umask

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Chris Gehlker
Date:  
Subject: scp/sftp umask
On Feb 5, 2004, at 1:56 PM, Gary Nichols wrote:

> On Thu, 5 Feb 2004, Craig White wrote:
>> # scp -r testdir exchange@localhost:
>> exchange@localhost's password:
>> #
>> and then finally...
>> back in the original directory...
>> ls -l
>> drwxrwxrwx    2 exchange dom_users     4096 Feb  5 10:20 testdir
>> -rwxr-xr-x    1 exchange dom_users      347 Feb  5 10:20 testfile2

>>
>> the directory is group writable, the file is not. This means that only
>> the user exchange can delete these files. This is not acceptable. This
>> has nothing to do with WinSCP
>
> Your permissions are getting whacked because you're not using the "-p"
> option to scp. Your command should be:
>
> scp -rp file user@localhost:/dir
>
> I have seen some man pages for scp that do not document this option for
> some reason.


But -p preserves the permission from the source file. Craig wants them
to be set by the destination umask. At least that's what I
understand. rcp and cp do it that way.