1836852 Members
3037 Online
110110 Solutions
New Discussion

scp permissions problem

 
SOLVED
Go to solution
dictum9
Super Advisor

scp permissions problem

Greetings,

When I scp a file, it retains the permissions that it had on the source box.

I have a case where a file is scp'ed from a Windows machine and it ends up as 700 permissions, while I would like to it to be 75, which is what the umask value is set to.

Any idea why the .profile is not read by scp?

5 REPLIES 5
Steven E. Protter
Exalted Contributor
Solution

Re: scp permissions problem

Shalom,

scp was made platform independent, it does not read .profile because not all OS' have that.

If you want to retain permissions, tar the files up first, transfer them then untar them.

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 Schweda
Honored Contributor

Re: scp permissions problem

> Any idea why the .profile is not read by scp?

Scp is not a shell? Why would it read your
.profile?

If you use scp to copy a file from a
non-Windows system, say, an HP-UX system, do
you have the same problem? (What does this
tell you?)
dictum9
Super Advisor

Re: scp permissions problem

1. I cannot use tar because the process is scripted, and the file gets moved without a password.

2. It's not a windows thing, I get the same thing happen when I scp from hp-ux to hp-ux.

In some cases it retains the permissions, it had and in other cases it doesn't. Strange.

I set the file to 777 and once it scp'ed over it got something like 7 66,but not 777.
Steven Schweda
Honored Contributor

Re: scp permissions problem

> In some cases it retains [...] and in other
> cases it doesn't.

This might be interesting if you offered some
kind of description of what's different
between the cases.

> Strange.

No, _strange_ would be expecting anyone to
provide any help based on virtually no
information.
OldSchool
Honored Contributor

Re: scp permissions problem

well you've a couple of issues....

a) AFAIK, windows "permissions" don't map directly to unix permissions.

b) If you've got a file with 777 permissions, and want those permissions retained, then use "scp -p"

c) You said you set the umask to 75, which is the desired permission???? I hope that's at typo. If not, you need to re-read how umask works.

we won't even discuss *why* 777 *shouldn't* be used