Change hostname in Ubuntu or Debian

If you’ve changed your mind about your Linux hostname or you’ve set to wrong hostname, here is how to fix it.

Firstly, I’ve tried the following command:

$sudo hostname mybrandnewname

But this will revert back to prior hostname whenever the machine reboots. So how can you change it permanently? First you’ll need to edit /etc/hostname file

$sudo vi /etc/hostname Then delete the old name and type whatevername you desire

It is also advisable to change new hostname in /etc/hosts file

Source : UbuntuManual

How to add new user and grant permission?

Once you’ve got your new favourite Linux distro installed, you’ll need to add users and grant permission as per your organization requirement.

The steps are very simple and straightforward.

sudo adduser

If you want to grant a user to all permissions as root, you should add that user to admin group. For example :

sudo adduser jason admin

Make sure the line “%admin ALL=(ALL) ALL” is present in the /etc/sudoers. The below is the screenshot of sample config file.

sudoers_screenshot

After that you might want to set specific password for the new user. You can do this by using the following command:

sudo passwd

Source : AskUbuntu

How to config ubuntu/debian to boot in text mode

I like Linux boxes to boot directly to terminal mode. If you’ve just moved to Ubuntu distro from Red Hat/ Fedora, you’ll think about changing the inittab. Well, bad news is in Debain or any of its derivatives, runlevels 2 to 5 are the same multi-user with display GUI. So if you type, sudo init 3, nothing will happen.

So here is how I make Ubuntu to boot into text mode by default. The requirement for this is you have to use grub as boot loader.

Just edit the /etc/default/grub using any of your favourite text editor, look for the line

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”

Then changed it to

GRUB_CMDLINE_LINUX_DEFAULT=”text”

The following is the screenshot for what my grub file looks like after the changes.

grub_ubuntu_screenshot

After that save the file and run sudo update-grub. That’s it. Starting from next reboot, your ubuntu/debian variants will start in text mode.

Source : UbuntuForums