Wednesday, June 30, 2010

Change hostname on ubuntu via CLI(Commad Line Interface)

To change the hostname permanently you have to edit two files /etc/hosts and /etc/hostname

Edit the file using your favourite text editor

In /etc/hosts add a new line which look like this

IP domain shortdomainnames

example:
127.0.0.1 linux.local linux

That will add a new local domain, one is the domain long name and the other is the domain shortname.

In /etc/hostname just edit the existing domain with the desired one

Regards.

Add a user to sudoers file on ubuntu

Here is short command to add a user to sudoers file.

#useradd username admin

Change existing Timezone on ubuntu via CLI(Command Line Interface)

Here i will explain how to change existing timezone on ubuntu via command line.

On ubuntu 6 series and older the command is:
#tzconfig

and then just follow the pop up blue screen CLI wizard

On ubuntu 7 and later the command is:
#dpkg-reconfigure tzdata

and then just follow the pop up blue screen CLI wizard

Hope that help

Regards

Change initial username on ubuntu server

Here i will explain how to change initial username of a user on ubuntu via CLI(Command Line Interface).

To change only username the command is :
#usermod -l newusername -m oldusername

To change username and home directory the command is:
#usermod -l newusername -d /home/newhomedir -m oldusername

Remember before you change the home directory please make sure that the newhomedir is exist or created

Don't forget to also change the group of the user you changes
#groupmod -n newgroupname oldgroupname

Usually groupname is same as username

Hope that help

Regards