LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-21-2010, 03:28 PM   #1
abti
LQ Newbie
 
Registered: Sep 2008
Location: Ohio
Distribution: RHEL6&7 (work) Fedora&Ubuntu(home)
Posts: 25
Blog Entries: 1

Rep: Reputation: 16
bash scripting chkconfig, chmod, and chown


I'm trying to write a simple(ler) bash script to does a mass changes in ~200 chmods, ~200 chowns, ~60 chkconfigs on 400+ systems. There's no real uniformity to any one of the three areas. I'm actually typing it in a very simplistic way...

===
sample code
===
#!/bin/bash

if [ ! $UID -eq 0 ]; then
echo "This script must be run as root."
exit 1
fi


/sbin/chkconfig nfs on
/sbin/chkconfig sendmail off

...

chmod 400 /etc/at.allow
chown root:root /etc/at.allow
chmod 600 /etc/at.deny
chown root:root /etc/at.deny
chown lp:sys /etc/cups/cupsd.conf

...


Again this is a simplified and truncated form of my script. Any help or advice would be appreciated!
 
Old 07-21-2010, 03:58 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Given ~400 systems, you might want to log the output from the script and diff it against expected output to identify any exceptions.

Perhaps pedantically, the command id -u is more robust than depending on $UID.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do I get "bash: chkconfig: command not found" when I try to run chkconfig? non-thrash Fedora 10 05-20-2010 01:31 PM
chown v/s chmod justmovedtolinux Linux - Newbie 3 10-02-2008 07:43 AM
chown and chmod specialized Linux - Hardware 9 04-04-2006 10:26 PM
chmod/chown and folders :) chibi Linux - Newbie 2 04-28-2005 05:56 PM
Understanding chmod, chown mikemrh9 Linux - Newbie 4 11-19-2004 04:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration