scp/sftp umask

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
Subject: scp/sftp umask
On Thu, 2004-02-05 at 17:51, Gary Nichols wrote:
> On Feb 5, 2004, at 2:28 PM, Chris Gehlker wrote:
> >
> > 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.
>
> Ah, I had to go back a few messages - but I believe you are correct.
> My bad.
>
> To the best of my knowledge, scp has always ignored UMASK on the
> destination shell side. Most of my automated scripts between boxes do
> something like this:
>
> scp -P $PORT $FILE $USER@$HOST:$DIR
> ssh $USER@$HOST CHMOD 760 $DIR/$FILE
>
> (assumes that you have shared public keys setup)
>
> Sorry Craig, didn't read back far enough.

---
now that I've had dinner and time to reflect upon this...

I understand that scp / sftp 'permit' the user to influence the owner,
group, all permissions but the one thing that I have learned to love
about Linux - which I have to presume comes from UNIX (since I am quite
unlearned on UNIX) is that the settings do not come from nowhere and the
answer that I received from my parents when I was a child...just because
doesn't apply here.

So I am left to wonder, where do these settings come from? Normally the
umask settings for any user come from the users shell settings and
failing anything in the user's profile, from the system profile. I
suppose that it's possible that the umask settings are derived from the
source code and compiled as a default and since I didn't peruse the
source code, I wouldn't know that. Perhaps this is a good time to
install the openssh source for clues.

One thing seems certain to me, that when I simply transfer files via
scp, the default, uninfluenced privileges assigned to any files and
folders have to come from somewhere.

Craig