Fix : No Hostname when using DHCP in Sun Solaris 8/9/10

If you are using DHCP to receive IP Address for your Sun Solaris system, you may end up with no hostname assigned to the system. This can be confirmed when there is no hostname at the prompt or if the output for the command “hostname” is as follows:

# hostname

unknown

or the /etc/hosts file has an entry as follows:

# cat /etc/hosts
#
# Internet host table
#
127.0.0.1 localhost
192.168.100.3 unknown # Added by DHCP

This happens when the DHCP server doesn’t provide a hostname for your server. Most of the DHCP Servers or routers acting as a DHCP Server doesn’t provide a hostname and Solaris DHCP agent relies on the DHCP server for its hostname.

To fix this problem, edit the dhcpagent config and set it not to request a Hostname from the DHCP server and then add a hostname to the /etc/hosts & /etc/nodename file.

Edit DHCPAGENT config

[For Solaris 10, this is not required as setting the hostname in /etc/nodename overrides the hostname provided by the DHCP Server. Move onto the next step]

Edit the dhcpagent config file /etc/default/dhcpagent with your favorite editor

# vi /etc/default/dhcpagent

and look for

PARAM_REQUEST_LIST=1,3,6,12,15,28,43

and remove the Parameter “12″ from the above to look as follows:

PARAM_REQUEST_LIST=1,3,6,15,28,43

and save the file.

Now, add the hostname to the /etc/nodename & /etc/hosts as follows

Note : if /etc/nodename file does not exist then create the file and add the parameter

# vi /etc/nodename

and add the hostname you want it to have (solarisserver for me)

# cat /etc/nodename
solarisserver

and edit the /etc/hosts file

# vi /etc/hosts

and add the line similar to the following

192.168.100.3 globalzone

Now,reboot the server and you should be all fine with hostname set for the system.

# init 6

Setup Subversion Server on Ubuntu

Step: 1 Installing the Subversion package

#apt-get install subversion

Step:2  Configure Subversion Directory

#mkdir –p  /home/svn/repository

Step 3 Configure Subversion group

#groupadd svn

#chgrp svn /home/svn/repository

#chmod g+rw /home/svn/repository

(you need to make sure that all new files and directories created in the repos directory (in other words, anything committed to the repositories) will also be owned by the group)

#chmod g+s /home/svn/repository

#usermod –a –G svn user1 (Assign users to svn group)

#usermod –a –G svn user2 (Assign users to svn group)

Step 4: Creating a New repository

#svnadmin create /home/svn/repository/test

Step 5: Checkout Repository

#svn checkout file:///home/svn/repository/test

Output: Checked out revision 0

Step 6: Add new files to Empty repository

#cd test

# echo ‘Hello, World!’ > hello.txt

#svn add hello.txt

Output : A         hello.txt

Step 7 : Commit files

#svn commit -m “Added a ‘hello world’ text file.”

Output :

Adding         hello.txt

Transmitting file data .

Committed revision 1.

Accessing SVN repository

Step 1:  Configure Users for Access SVN repository.

#vi /home/svn/repository/conf/authz

(Add below entry)

[/]

User1 = rw

[/test]

User1 = rw

User2 = rw

(save file)

#vi /home/svn/repository/conf/passwd

(Add below entry)

User1=password1

User2=password2

(save file)

Step 2: Configure files for authentication

# rm –rf /home/svn/repository/test/conf/authz

# rm –rf /home/svn/repository/test/conf/passwd

#vi /home/svn/repository/conf/svnserve.conf

[general]

anon-access = none

password-db = /home/svn/repository/conf/passwd

realm = Team

Step 3: Start repository

#svnserve -d –foreground -r /home/svn/ repository

Step 4 : Test the Repository

#svn checkout svn://ipaddress/test –username user1

Step 5: Initialize the Script at Startup


#wget http://odyniec.net/articles/ubuntu-subversion-server/svnserve

#move svnserve /etc/init.d/

# chmod +x /etc/init.d/subserve

#update-rc.d svnserve defaults

Solaris and Linux Runlevel

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

CentOS5/RHEL5 User Administration

1) Add User

Useradd

2)      Delete user

Userdel

3)      Modify user

Usermod

4) Add Group

gpasswd

5) Delete group

groupdel

6) Modify group

groupmod

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)

useradd1

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

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_LOGs*=.*)$/#1/’ denyhosts.cfg
sudo sed -i.bak ‘s/^s*#s*SECURE_LOGs*=s*/var/log/secure/SECURE_LOG = /var/log/secure/’ denyhosts.cfg
sudo sed -i.bak ‘s/^s*(LOCK_FILEs*=.*)$/#1/’ denyhosts.cfg
sudo sed -i.bak ‘s/^s*#s*LOCK_FILEs*=s*/var/run/denyhosts.pid/LOCK_FILE = /var/run/denyhosts.pid/’ denyhosts.cfg
sudo sed -i.bak ‘s/^s*(BLOCK_SERVICEs*=.*)$/#1/’ denyhosts.cfg
sudo sed -i.bak ‘s/^s*#s*BLOCK_SERVICEs*=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_BINs*=s).*$/1″/usr/bin/denyhosts.py”/’ daemon-control
sudo sed -i.bak ‘s/^(s*DENYHOSTS_LOCKs*=s).*$/1″/var/run/denyhosts.pid”/’ daemon-control
sudo sed -i.bak ‘s/^(s*DENYHOSTS_CFGs*=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

Setup SAMBA server on Ubuntu

Step 1: Installation

#apt-get install samba

Step 2: Configuration

Configuration file : /etc/samba/smb.conf

  • Edit below section

Workgroup = EXAMPLE

…………

Security = user

  • Create a new section at the bottom of the file /etc/samba/smb.conf

[Samba Share]

Comment= Samba  File Server Share

Path=/path to directory

Browsable = yes

Guest ok = yes

Read only = no

Create mask = 0755

Step 3: Create directory and change permissions

#mkdir /path to directoy

#chown  -R nobody:nobody /path to directory

Step 4 : Restart Samba service

#/etc/init.d/samba restart

Enjoy!!!!!!!!!!!!