Default Linux Run Level: Total 7 Run Level
RunLevel 0: Halt System - To shutdown the system
RunLevel 1: Single user mode
RunLevel 2: Basic multi user mode without NFS
RunLevel 3: Full multi user mode (text based)
RunLevel 4: unused
RunLevel 5: Multi user mode with Graphical User Interface
RunLevel 6: Reboot System
Default Solaris Run Level: Total 8 Run Level
RunLevel S: Single user state (useful for recovery)
RunLevel 0: Access Sun Firmware (ok> prompt)
RunLevel 1: System administrator mode
RunLevel 2: Multi-user w/o NFS
RunLevel 3: Multi-user with NFS
RunLevel 4: Unused
RunLevel 5: Completely shutdown the host (like performing a power-off)
RunLevel 6: Reboot but depend upon initdefault entry in /etc/inittab
Remote Server Management Code Management Network Management Automation System Administration Linux Solaris, Backup, Networking, Security, Mysql, Script, Tips & Tricks
Tuesday, September 29, 2009
Configure Services in CentOs5/RHEL5
1) List All services

2) List Running services at Runlevel 3

3) Start service

4) Stop service

5) Start service on different RunLevel

6) Restart services

7) Add services

8 ) Remove Services

2) List Running services at Runlevel 3
3) Start service
4) Stop service
5) Start service on different RunLevel
6) Restart services
7) Add services
8 ) Remove Services
Monday, September 28, 2009
CentOS5/RHEL5 User Administration
1) Add User

2) Delete user

3) Modify user

4) Add Group

5) Delete group

6) Modify group

7) Add User to Group
Use useradd command to add new users to existing group (or create a new group and then add user). If group does not exist, create it. Syntax:
Syntax:
useradd -G {group-name1},{group-name2} username (for secondary group)
useradd -g {group-name} username (for primary group)

2) Delete user
3) Modify user
4) Add Group
5) Delete group
6) Modify group
7) Add User to Group
Use useradd command to add new users to existing group (or create a new group and then add user). If group does not exist, create it. Syntax:
Syntax:
useradd -G {group-name1},{group-name2} username (for secondary group)
useradd -g {group-name} username (for primary group)
Tuesday, September 15, 2009
Automated Installation of DenyHost on RedHat/Fedora
#Script
#!/bin/bash
# This script installs Deny Host on RedHat(RHEL) or Fedora.
################################################################################
# This script comes with no warranty or guarantee. Please review the script
# before you run it to ensure that it will not cause adverse effects on your
# system.
# If you have any questions or comments, please e-mail: sanjaydalal4u@gmail.com
################################################################################
sudo echo
if [ -f /etc/init.d/denyhosts ]; then
echo Removing existing init scripts
sudo /etc/init.d/denyhosts stop
sudo rm -rf /etc/init.d/denyhosts
sudo chkconfig --remove denyhosts
echo '*********************'
echo
fi
if [ -d /usr/share/denyhosts/ ]; then
echo Removing existing installation
sudo rm -rf /usr/share/denyhosts
echo '*********************'
echo
fi
echo Installing 'python' and dependencies.
sudo yum -y install python
echo '*********************'
echo
cd /root
echo Downloading DenyHost
wget http://downloads.sourceforge.net/project/denyhosts/denyhosts/2.6/DenyHosts-2.6.tar.gz?use_mirror=biznetnetworks
echo '*********************'
echo
echo Unpacking DenyHost
#!/bin/bash
# This script installs Deny Host on RedHat(RHEL) or Fedora.
################################################################################
# This script comes with no warranty or guarantee. Please review the script
# before you run it to ensure that it will not cause adverse effects on your
# system.
#
# If you have any questions or comments, please e-mail: sanjaydalal4u@gmail.com
################################################################################
sudo echo
if [ -f /etc/init.d/denyhosts ]; then
echo Removing existing init scripts
sudo /etc/init.d/denyhosts stop
sudo rm -rf /etc/init.d/denyhosts
sudo chkconfig --remove denyhosts
echo '*********************'
echo
fi
if [ -d /usr/share/denyhosts/ ]; then
echo Removing existing installation
sudo rm -rf /usr/share/denyhosts
echo '*********************'
echo
fi
echo Installing 'python' and dependencies.
sudo yum -y install python
echo '*********************'
echo
cd /root
echo Downloading DenyHost
wget http://downloads.sourceforge.net/project/denyhosts/denyhosts/2.6/DenyHosts-2.6.tar.gz?use_mirror=biznetnetworks
echo '*********************'
echo
echo Unpacking DenyHost
#!/bin/bash
# This script installs Deny Host on RedHat(RHEL) or Fedora.
################################################################################
# This script comes with no warranty or guarantee. Please review the script
# before you run it to ensure that it will not cause adverse effects on your
# system.
# If you have any questions or comments, please e-mail: sanjaydalal4u@gmail.com
################################################################################
sudo echo
if [ -f /etc/init.d/denyhosts ]; then
echo Removing existing init scripts
sudo /etc/init.d/denyhosts stop
sudo rm -rf /etc/init.d/denyhosts
sudo chkconfig --remove denyhosts
echo '*********************'
echo
fi
if [ -d /usr/share/denyhosts/ ]; then
echo Removing existing installation
sudo rm -rf /usr/share/denyhosts
echo '*********************'
echo
fi
echo Installing 'python' and dependencies.
sudo yum -y install python
echo '*********************'
echo
cd /root
echo Downloading DenyHost
wget http://downloads.sourceforge.net/project/denyhosts/denyhosts/2.6/DenyHosts-2.6.tar.gz?use_mirror=biznetnetworks
echo '*********************'
echo
echo Unpacking DenyHost
tar -xzf DenyHosts-2.6.tar.gz
cd /root/DenyHosts-2.6
echo '*********************'
echo
echo Installing DenyHost
sudo python setup.py install
echo '*********************'
echo
cd /usr/share/denyhosts
echo Configuring DenyHost
sudo cp denyhosts.cfg-dist denyhosts.cfg
sudo sed -i.bak 's/^\s*\(SECURE_LOG\s*=.*\)$/#\1/' denyhosts.cfg
sudo sed -i.bak 's/^\s*#\s*SECURE_LOG\s*=\s*\/var\/log\/secure/SECURE_LOG = \/var\/log\/secure/' denyhosts.cfg
sudo sed -i.bak 's/^\s*\(LOCK_FILE\s*=.*\)$/#\1/' denyhosts.cfg
sudo sed -i.bak 's/^\s*#\s*LOCK_FILE\s*=\s*\/var\/run\/denyhosts.pid/LOCK_FILE = \/var\/run\/denyhosts.pid/' denyhosts.cfg
sudo sed -i.bak 's/^\s*\(BLOCK_SERVICE\s*=.*\)$/#\1/' denyhosts.cfg
sudo sed -i.bak 's/^\s*#\s*BLOCK_SERVICE\s*=\s*ALL/BLOCK_SERVICE = ALL/' denyhosts.cfg
echo '*********************'
echo
echo Configuring executable
sudo cp daemon-control-dist daemon-control
sudo sed -i.bak 's/^\(\s*DENYHOSTS_BIN\s*=\s\).*$/\1"\/usr\/bin\/denyhosts.py"/' daemon-control
sudo sed -i.bak 's/^\(\s*DENYHOSTS_LOCK\s*=\s\).*$/\1"\/var\/run\/denyhosts.pid"/' daemon-control
sudo sed -i.bak 's/^\(\s*DENYHOSTS_CFG\s*=\s\).*$/\1"\/usr\/share\/denyhosts\/denyhosts.cfg"/' daemon-control
sudo chown root daemon-control
sudo chmod 700 daemon-control
echo '*********************'
echo
echo Adding ddclient to rc scripts
cd /etc/init.d
sudo ln -s /usr/share/denyhosts/daemon-control denyhosts
sudo chkconfig --add denyhosts
sudo chkconfig --level 35 denyhosts on
echo '*********************'
echo
Subscribe to:
Comments (Atom)