The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Security
Google UNIX.COM


Security Anything involving computer security goes here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to change the permissions of ksh? ponnuvel UNIX for Advanced & Expert Users 3 04-15-2008 12:17 AM
Recursively changing permissions on files altamaha UNIX for Dummies Questions & Answers 1 03-01-2008 01:15 AM
Change permissions of /var/log/messages anindra UNIX for Dummies Questions & Answers 3 11-05-2007 08:53 AM
need command to change permissions calredd UNIX for Dummies Questions & Answers 1 04-28-2007 09:53 AM
How to change permissions in UNIX? a8111978 Filesystems, Disks and Memory 2 06-24-2002 11:40 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-29-2008
Registered User
 

Join Date: Feb 2008
Location: Georgia
Posts: 15
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Recursively find and change Permissions on Man pages

Just joined after using the site as a guest.. (Very Good Stuff in here.. thanks folks.)

I am in the process of hardening a Solaris 10 server using JASS. I also must use DISA Security Checklists (SRR) scripts to test for things that did not get hardened to DISA standards.

One of the things missing is a script that would change all of the permissions on various man pages to be no more permisive than 644.

I know I can do it by manually finding and changing them, but it would be great if someone allready had a script in place.

Thanks again for a great place to browse and learn.

Altamaha
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-01-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,252
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
How about just:
find /usr/share/man -type f | xargs chmod 644
Reply With Quote
  #3 (permalink)  
Old 03-01-2008
Registered User
 

Join Date: Oct 2007
Posts: 30
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
you can use chmod -R, always try man page before posting...
Reply With Quote
  #4 (permalink)  
Old 03-03-2008
Registered User
 

Join Date: Feb 2008
Location: Georgia
Posts: 15
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Thanx to both of you for your suggestions. I was and am going to be using whatever we discover here as a learning tool to be applied across other directories where permissions need to be changed.

I am wanting to find files that are more permissive than in this case 644 and change them to 644. That would be accomplised by either of your examples I think.

I may need to run my scripts more than once and need only make changes if the files are more permissive than stated, plus I also need to capture the changes in a log for documentation.

I guess I need an ls -l of the directory to get the perms and based on the perms then perform a chmod and >> to a logfile.

Does that make any sense?

Thanks,
JB aka Altamaha
Reply With Quote
  #5 (permalink)  
Old 03-05-2008
Registered User
 

Join Date: Feb 2008
Location: Georgia
Posts: 15
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
I tried to post this under the Dummies forum in hopes of because it is actually more dumb than security, but I was shut down for double posting.

Now that I am willing to abide by the rules, and after some help from some others on the group, I offer this bit of code hoping that someone can show a better way to get where I am heading.

I am using the suggested fid command, but I do not know how one would use the "greater than" check against the permission bits.

Code:
#!/bin/sh
#
#
# ident "@(#)stewart-set-manpage-permissions.fin       1.1     08/02/08"
#
# Set permissions for manual pages to no more permissive than 644.
# Reference GEN001280 UNIX Security Checklist V 5R1.5.
#
#
#
MANDIR=/usr/share/man

for FILENAME in `find $MANDIR -type f -perm -7 -o -type f -perm -6
     -o -type f -perm -5 -o -type f -perm -3 -o -type f -perm -2 -o -type f -perm -1`
do
     #chmod 644 $FILENAME
     ls -l $FILENAME
done
Thank you,
JB aka Altamaha
Reply With Quote
  #6 (permalink)  
Old 03-25-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 2,249
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Quote:
Originally Posted by altamaha View Post
I am using the suggested fi[n]d command, but I do not know how one would use the "greater than" check against the permission bits.
GNU find at least has some more advanced options for this. Is installing it an option?

Also, even with regular basic old-skool BSD find, I don't really think you need to painstakingly repeat the -type f -- just add parentheses, but note that you have to backslash-escape them because they are special to the shell, too.

Code:
find $MANDIR -type f \( -perm -7 -o -perm -6 -o -perm -5 -o -perm -3 -o -perm -2 -o -perm -1 \)
Of course, if you want to say "any bit except 4", that is doable too, at least with GNU find:

Code:
find $MANDIR -type f -perm /3
Also look at find2perl -- its documentation is somewhat terse but if you can't quite say what you want with the bare find(1) options, it might be less frustrating to make minor edits to a generated Perl script. Quick Googling brought up this brief tutorial
Reply With Quote
Google UNIX.COM
Reply

Tags
solaris

Thread Tools
Display Modes


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash for loop boot: cannot open kernel/sparcv9/unix command copy/move folder in unix curses.h cut command in unix daemon process find grep find mtime find null character in a unix file from ip can we get machine name +unix glance unix grep multiple lines grep or grep recursive how to redirect console logs in unix inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime perl array length ping port remove first character from string in k shell replace space by comma , perl script scp recursive segmentation fault(coredump) sftp script snoop unix stale nfs file handle syn_sent tar exclude tar extract to folder unix unix .profile unix forum unix forums unix internals unix interview questions unix mtime unix simulator unix.com vi substitute while loop within while loop shell script


All times are GMT -7. The time now is 12:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101