Tag Archives: ubuntu terminal

how to login as root in ubuntu 10.04

login as root

By default you can’t login as root in ubuntu 10.04 or other linux distribution due to the security policy of linux.Suppose you have logged in as root in ubuntu and by mistake you did something wrong then your system may be crash.But administrative power is required in some cases such as in installing some programs to solve file permission problem while working on file system.That’s why there is a simple solution and is sudo command.hence you can do administrative task or run administrative commands followed by sudo.Hence in this method you will have to work in command line interface.So in the case if you don’t know much more about ubuntu commands OR you feel irritating in doing some administrative task fr0m command line then you can enable the root login fr0m the login menu  and run as a root.

Hence It is very simple to enable root logging in graphical or GUI mode, just follow these simple steps –

step1. Open the bash terminal.

ubuntuuser@ubuntuuser-desktop:~$

step2. Type the command  sudo passwd root.First it will ask for the user password.Enter your current-user session password and and hit enter.

ubuntuuser@ubuntuuser-desktop:~$ sudo passwd root

[sudo] password for ubuntuuser:

step3. Then it will ask for new password.Enter a new password twice.This is the password you will use this in future for logging as root.

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

ubuntuuser@ubuntuuser-desktop:~$

step4. To check whether it is working or not just logout fr0m the current session.At login prompt,choose other as a user account.Next, in the place of username write root and the password you just defined in the above step.

step5. that’s all..I hope your work is done.

NOTE : If you logged in as root then you must be careful about the each activities.After finishing the administrative task you should return to the normal mode.

You may like this post : A simple tutorial to learn- how to secure from internet threats.

What is sudo in Ubuntu?

Sudo commands in linuxIn early days it was difficult to manage the permissions for different users in a multiuser operating system that may be a client or server;suppose every user has a power of a superuser or root then any one of them may be misused the system either intentionally(If the user is smart) or ignorantly(If the user is a beginner one).Hence the simple solution of this problem is to limit the power for every users according to their need so that they can do simple tasks normally but in case of any administrative task root power is granted for small period(usually five minutes)by using the sudo commands.In sudo su stands for superuser and do means do(as usual).Hence sudo is mostly used by a permitted user for taking the permission to execute some commands as a another user or superuser, according to the information specified in sudoers file.Suppose the user that is invoking a command using the sudo power, is root then there is no need to enter user password.By default authentication is required and the user password is required; the user may use the sudo power again for short period of time(5-15min).So sudo is very useful in finishing some administrative task by a simple user.Now we are going to learn something more about the sudo commands.

Syntax of the sudo commands :


It is very simple..just use the word sudo before the actual command and hit enter.Then it will ask for the users password ..enter the password after the authorization process the commands will execute.e.g I am trying to execute commands1(installing a package using apt-get).

user840@user840-desktop:~$ sudo commands1
[sudo] password for user840:
Reading package lists… Done
Building dependency tree
Reading state information… Done

….and so on the execution will complete.

Options in SUDO :

-A : Using this option the another helper program(It may be in graphical format) is called and executed to read the password of the user and output the user password to the canonical output.

-u user : this option tells the sudo to run the target command as a user instead of root(which is default case).You may use UID rather than username by using UID followed by ‘#’.i.e #uid.
-a : It is used by the sudo to use the special authentication type for the validation of the user according to the permission settings stored in /etc/login.conf.
This option is is used only in the system having the support with BSD authentication mechanism.

-b : Specifying -b(background) with the sudo command simply means to order the sudo that “run the target command in background”.

-p prompt : By using -p (prompt) one can easily customize the password prompt.So using some ‘%’ escapes(e.g %H,%h,%p) you may use any other prompt rather then the default one.

Although there are many other options available but you can easily find out in your bash shell.just type info sudo and hit enter.

Environment Variables :

here are the some environment variables used by the sudo.

USER : Set to the current user.By default its value is equal to root if -u option is not specified.

SUDO_UID : user ID of the user who used the sudo.

SUDO_USER : Set to the login of the permitted user who is using sudo.
Go to your bash terminal for the details about the more environmental variables(info sudo OR man -k sudo OR help sudo).

Credit : Todd C. Miller

Easy Way to learn bash commands-tutorial-1|Linux-Ubuntu CLI

Bash comes installed with the most of the linux distribution(With MAC-OS also) such as in Ubuntu. The aim of this tutorial to explain about the need and importance about the bash commands followed by the practical use of basic commands.

These days there are so many excellent charming and cool graphical user interfaces are available So you may think that learning about the bash commands and command line interface are unnecessary, probably you like the abstraction created by graphical interfaces and you are able to do the tasks by simply clicking the mouse.

But in the case if you want to know the background explaination or the communication involved between your application softwares and operating system, learning bash commands is not a bad idea(Actually it’s a GREAT IDEA). As it allows you to pass and execute commands to kernel of your linux machine and hence it finish the task in less time as compared to GUI. In linux based distributions such as ubuntu, basics of bash commands is necessary to perform some administrative task. Hence if you are going to be an computer programmer or network security expert or you want to administrate your computer well,then you can enjoy learning bash commands.In fact it is easy and interesting…

Some basic commands in bash shell :

1. CD command :It is used for changing the working directory in the bash shell.Suppose you are working in home directory and you want to change it to Desktop then you can use the cd command as- SYNTAX : cd directory(to which you want to go)

rk10@rk-desktop:~$ cd Desktop               #here I have used relative path,you can use full path if the selected sub directory/or other destination  is not available in that directory.
rk10@rk-desktop:~/Desktop

2. MAN Command
To access the Manual.
man cd

How To Learn Ubuntu-Linux Commands

Learning bash/zsh/ssh shell commands is not so complex and boring as it seems.In fact when you will start learning bash shell commands then its initial steps may  looks ugly but when you will have some basic idea about commands then afterwards you will feel a keen interest in learning further commands.Working on command  line  interface is really have its own taste and significance even though in high graphical environment era.In linux ubuntu, if you want to do some admininstrative  task which is related to the information contained within the system files,then you can’t do that directly;the reason behind this is- all the users of the linux have some restricted access by default.

If you want to finish that administrative task then you will have to login as a root user,which is really not so simple in linux because of the linux ubuntu security policy(That’s why linux operating system is secure by default in compare to other operating system like windows where a five year child can corrupt the whole system by deleting a system file).In other ways you can finish such administrative task by using command line in few minutes,by gaining  the temperory root power using sudo command followed by the user account password.

To learn the basic/advanced linux-ubuntu bash shell commands simply follow these basic steps :

STEP1 : Learn some simple bash-commands then Open the bash/terminal from Application=>accessories=>terminal or use CTRL+ALT+F2 to open a virtual console(Return  to the graphical interface by pressing CTRL+ALT+F7).

STEP2 : For more details on any command just type help command_name(about which you want to know more),bash itself is a great place to learn more about commands and their parameters, or use the man command to access the bash manual.

STEP3 : Try to use the commands frequently that you learned.

STEP4 : That’s all ! Enjoy learning about the commands.. and for more info and tutorial on the ubuntu-bash commands visit the next posts,which contains

Start Learning Basics Linux Commands