Wednesday, May 26, 2010

How to make a permanent hostname for a redhat linux system

To make a permanent hostname for a redhat linux system, edit the following file
# vi /etc/sysconfig/network
HOSTNAME=station1.example.com

save this file. Now check the file /etc/hosts, it contain the old hostname, change/delete it.

restart the network service.
# service network restart

Logout and then login again.


   

Tuesday, May 25, 2010

root, sudo and shells

To start a root shell, starting root's environment and login scripts, use:
sudo -i
This is similar to sudo su - , gives you roots environment configuration.

To start a root shell, but keep the current shell's environment, use:
sudo -s 
This is similar to sudo su

 
 

Monday, May 24, 2010

How to disable root login (or any user's login)

If you want to disable root user's login (or any other user's login), you can change his/her home directory to /sbin/nologin or /bin/false.

Now user can not login into any shell.