1850444 Members
3049 Online
104054 Solutions
New Discussion

Default permissions

 
SOLVED
Go to solution
Dermot Beirne
Frequent Advisor

Default permissions

Hi have inherited a system that was not very well taken care of. It is running HPUX 10.20 If something seemed suspect, the first thing tried was chmod 777 on the whole directory, etc! I would like to start by getting the permissions back to normal. Is there somewhere I can get a list of what the default permissions of all the key system directories, e.g. /etc /dev, etc. should be.
Thanks.
Dermot
Happy is harder than money. Anyone who thinks money will make them happy, doesn't have money.
3 REPLIES 3
Volker Borowski
Honored Contributor

Re: Default permissions

Hi Dermont,

well I guess at first I think you need to have a reference system, to look up what you want to set.

I would start there with
ls -l | cut -c2- | awk '{ print "chmod " $1 " " $9 }' >file_to_be_edited.sh

In this file_to_be_edited.sh globaly exchange
--x -> 1
-w- -> 2
-wx -> 3
r-- -> 4
r-x -> 5
rw- -> 6
rwx -> 7

and so on ...

Check (!) and execute it, and I guess 85% is done.
Do corresponding if user and group has been changed in addition.

Base your listing on
ls -l `find /etc -print`
if you need to recurse the subdirs (this will take time).

Compare the above output of both systems to find diffrences.

Hope this helps
Volker
Stefan Farrelly
Honored Contributor
Solution

Re: Default permissions


All the default permissions for the key system directories and files are in;

/var/adm/sw/products/OS-Core/UX-CORE/INFO

Search this file (INFO) for path and mode commands;

grep -e path -e mode INFO

and it will list paths (files or dirs) and their permissions after each one. If several paths are together before a mode entry then all the files/dirs have the same permissions as the following mode entry. You should be able to write a script to read all this in and apply it.
Im from Palmerston North, New Zealand, but somehow ended up in London...
James R. Ferguson
Acclaimed Contributor

Re: Default permissions

Hi Dermot:

Andreas Voss wrote an elegant awk script to rectify this very problem. See this thread for his script:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xa7ef6c96588ad4118fef0090279cd0f9,00.html

...JRF...