HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

scp does not create correct permissions

 
SOLVED
Go to solution
dictum9
Super Advisor

scp does not create correct permissions


When a filed is scp'ed, it has 600 permissions. when the same account does a 'touch' on the file, it has correct permissions of 751. What's going on?

This is on 11.23, Itanium machine.

the source machine has correct permissions on the file.

FWIW, the box has been recently converted to a trusted host.

9 REPLIES
Michal Kapalka (mikap)
Honored Contributor
Solution

Re: scp does not create correct permissions

hi,

maybe the UMASK is different set.

mikap
James R. Ferguson
Acclaimed Contributor

Re: scp does not create correct permissions

Hi:

Adding the '-p' switch to 'scp' will preserve the modification and last-access timestamps along with a file's modes.

Regards!

...JRF...
Matti_Kurkela
Honored Contributor

Re: scp does not create correct permissions

Are you using scp to "push" a file from your session to a remote host, or "pull" it from a remote host to you?

When you run scp, it performs a "non-interactive login" to the remote host. Most shells will skip large parts of the session startup procedure if the session is not interactive... for example, the shell might not run /etc/profile at all. In this case, the umask of the remote end might be determined only by kernel/sshd defaults, and thus be different from the usual value.

Most likely James's suggestion to use the "-p" option will help. If not, you may have to do some reading.

If you're pushing the file to a remote host, find out which shell the destination account is using at the remote host, then read the man page of that shell. Pay special attention to chapters titled like "STARTUP", "INVOCATION" etc.

MK
MK
Steven Schweda
Honored Contributor

Re: scp does not create correct permissions

> scp does not [...]

In general, as with nearly all programs, what
scp does or does not do may depend on what
you tell it to do. And if you've disclosed
that, I must have missed it.

> What's going on?

You first.

> This is on 11.23, Itanium machine.

_What_ is? The client or the server? The
source or the destination? And what's at
the other end?
Steven E. Protter
Exalted Contributor

Re: scp does not create correct permissions

Shalom,

umask can be over-ridden in the sshd_config or the ssh_config file

touch works off the user profile.

scp is like ftp, and does not read the full user profile.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven E. Protter
Exalted Contributor

Re: scp does not create correct permissions

Sorry for the split post.

No matter what the umask, scp or sftp will not give 7 permissions on a file.

That is because doing so creates a massive security hazard.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
UVK
Trusted Contributor

Re: scp does not create correct permissions

Try using the switch "-p", if you still have problems check the umask on the destination server
-------------------------------------------
Like it or worked !! Click kudos !!

Re: scp does not create correct permissions

>does a 'touch' on the file, it has correct permissions of 751.

I don't see how? touch(1) should only start with 666. It could only be 640 and not have the "x" bits. And I assume umask is 26.
$ typeset -i8 x=0
$ (( x = 8#751 & ~8#111 )); echo $x
8#640
Suraj K Sankari
Honored Contributor

Re: scp does not create correct permissions

Hi,

scp mostly used the sshd_config file and when you login that time .profile is used
check you sshd_config file is there umask is set or not.


Suraj