checking permissions security


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers checking permissions security
# 1  
Old 01-01-2008
checking permissions security

Can you help me to find a way to check that the level of the permissions givven to Others is not higher then the permission given to Group that is not higer from Owner permissions ?
# 2  
Old 01-03-2008
try this

$ aclget file1
attributes:
base permissions
owner(tester): rw-
group(staff): ---
others: ---
extended permissions
disabled
$
$ cat ownership
0 --
1 --x
2 -w-
3 -wx
4 r--
5 r-x
6 rw-
7 rwx

$for i in `aclget file1`
do
grep -e $i ownership | awk '{print $1}'
done > a12

echo file1 has the permission of `cat a12`
# 3  
Old 01-03-2008
long winded way.
Code:
# assumption: No setuid/setgid bits
ls -l | awk 'BEGIN {
 perm["rwx"]=7
 perm["rw-"]=6
 perm["r-x"]=5
 perm["r--"]=4
 perm["-wx"]=3
 perm["-w-"]=2
 perm["--x"]=1
 perm["---"]=0
}
{
    ow=substr($1,2,3)
    gr=substr($1,5,3)
    ot=substr($1,8,3)
    if ( ( perm[ow]  >= perm[gr] )  && ( perm[gr] >= perm[ot] ) ) {
      print $NF
    }
}'


Last edited by ghostdog74; 01-03-2008 at 10:53 PM..
# 4  
Old 01-15-2008
thanks it is great

it is working good:

Code:
echo " "
echo "Checking permissions"
echo " "
echo "Enter Base Directory: "
read source_dir
echo " "
ls -l $source_dir | awk 'BEGIN {
 perm["rwx"]=7
 perm["rw-"]=6
 perm["r-x"]=5
 perm["r--"]=4
 perm["-wx"]=3
 perm["-w-"]=2
 perm["--x"]=1
 perm["---"]=0
}
{
    ow=substr($1,2,3)
    gr=substr($1,5,3)
    ot=substr($1,8,3)
    #if ( ( perm[ow]  < perm[gr] )  || ( perm[gr] < perm[ot] ) ) {
    if ( perm[ow]  < perm[gr] ) {
      print "File "$NF" : "$1" "perm[ow]perm[gr]perm[ot]" --> Group "perm[gr]" > Owner "perm[ow]
    }
    if ( perm[gr] < perm[ot] ) {
      print "File "$NF" : "$1" "perm[ow]perm[gr]perm[ot]" --> Other "perm[ot]" > Group "perm[gr]
    }
}'

 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. SCO

Stop boot system at "Checking protected password and checking subsystem databases"

Hi, (i'm sorry for my english) I'm a problem on boot sco unix 5.0.5 open server. this stop at "Checking protected password and checking subsystem databases" (See this image ) I'm try this: 1) http://www.digipedia.pl/usenet/thread/50/37093/#post37094 2) SCO: SCO Unix - Server hangs... (9 Replies)
Discussion started by: buji
9 Replies

2. Shell Programming and Scripting

Checking directory permissions on UNIX directory

Hi, How do i check if I have read/write/execute rights on a UNIX directory? What I'm doing is checking read access on the files but i also want to check if user has rights on the direcory in whcih these files are present. if then...... And I check if the directory exists by using... (6 Replies)
Discussion started by: chetancrsp18
6 Replies

3. Solaris

Unix file, folder permissions, security auditing tools.

I want to periodically check if ASCII password/config files on Unix have 400 or 600 access. Folders and files are owned by designated group and user. Folders and Files do not have world write access. Are there any tools/scripts available for this kind of auditing that I can use on Solaris? (7 Replies)
Discussion started by: kchinnam
7 Replies

4. Shell Programming and Scripting

checking Permissions of file for OTHERS and GROUP

Hi, Is their a way to check the read and execute permission on a file on OTHERS and GROUP rwxr--r-x I am trying something like: if ( || ) then .... fi The code above only checks the permissions of the owner of the file but not for the GROUP and OTHERS. I will really... (5 Replies)
Discussion started by: rkumar28
5 Replies

5. Shell Programming and Scripting

checking for permissions of a file

Hi, I have a script called check.sh. I have to pass a file as input to this script. How can I validat whether the file has read permissions or not within the script. Thanks in advance (1 Reply)
Discussion started by: sendhilmani123
1 Replies

6. Shell Programming and Scripting

Checking and chaning directory permissions automatically

Hi all, My first post here. I need a small script to check the directory permssions on my /home/uploads and if there are any newly created directory in uploads chmod them to 1777. The upload directory is for my users who upload their pictures and I by default their directories are given... (4 Replies)
Discussion started by: apachi
4 Replies

7. Shell Programming and Scripting

checking file's permissions and change them

Hi all, I am very new to UNIX and Shell scripting, I need to run a script to check for file's and directoires permissions and change the permissions if necessary. I appreciate your help.. Thanks (7 Replies)
Discussion started by: K-ONE
7 Replies

8. Cybersecurity

permissions and security with windows 2000 server

I setup a Windows 2000 Server so that a G4 could access one specific folder. The only way this contact could take place between the two operating systems is with Maclan. I have not installed it with the PCmaclan currently, I have only been reading about it. Can someone assist me with this... (0 Replies)
Discussion started by: pmoncriffe
0 Replies
Login or Register to Ask a Question