Ben Conner
asked on
default permissions assigned by cp command in Unix
Hi,
What is the default permissions mask when using the cp command in Unix? it appears to be 644. I would like to have it be 770. Umask won't help in this instance as it only takes away permissions, it doesn't add them, apparently? Is there another way to get that done w/o having to chmod every copied file?
Thanks!
--Ben
What is the default permissions mask when using the cp command in Unix? it appears to be 644. I would like to have it be 770. Umask won't help in this instance as it only takes away permissions, it doesn't add them, apparently? Is there another way to get that done w/o having to chmod every copied file?
Thanks!
--Ben
cp -p will preserve permissions, so if original permissions are 770...
ASKER
Ah. That explains a lot. :) What about when creating a file from scratch?
--Ben
--Ben
ASKER
If I wasn't using the -p argument, what would cp do? This was in a script I had run.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ah. So there are default permissions masks associated with individual userids and groups? That is probably what the root cause of this is, then. Is there a non-su command available to change that default?
The directory you are copying into probably has rw-r--r-- (644) security set. Files created (cp without -p) in there will have those as well. Changing that directory to rwxrwx--- will give you your default of 770 (again without umask).
ASKER
Hm. Just checked and all the target folders had 770 assigned. Is there a default security setting assigned when an account is set up? Never been an admin so I wouldn't know. They don't give me sharp objects.
--Ben
--Ben
That would be the umask. Can you check umask? Just type umask to display the current.
ASKER
Hi Gerwin,
Thanks, will look at that when I get in to work in a little while. I guess though I was trying to confirm that while setting up a userid for the first time, there is a spot where the admin sets this for that account as a default?
--Ben
Thanks, will look at that when I get in to work in a little while. I guess though I was trying to confirm that while setting up a userid for the first time, there is a spot where the admin sets this for that account as a default?
--Ben
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That nails it. So my assumption is if an admin can create it, they can modify it. That would save us a lot of hassle.
Thanks much!!
--Ben
Thanks much!!
--Ben
ASKER
Excellent insight on an area that isn't very well documented in common references.