Saturday, June 5, 2010

Log in as root in Ubunutu 10.04 (Lucid Lynx)



Open the terminal and enter the following commands:


$ sudo -s


Now when prompted enter your user password.
Now, are working as root. Enter the following command to set the password for root:



$ passwd


Enter your desired password for root.
(Note:You can use this command to reset a forgotten password for your current user account as well)
Close the terminal and logout.
Enter the username as "root" and type the password that you'd typed in earlier.
Hurray,now you'll be operating as root.

Alternatively: It's never recommended to work as root as this will expose your system to vulnerabilities. Use it only when you have to perform extensive tasks with root priviliges. However I would like to recommend a cool command called "sudo !!". It's useful when you've entered a command but get a warning saying that "you need to be root", then just enter the command "sudo !!".eg.




$ aptitude search bluefish



You'll most likely get an error saying that you need to be root, then instead of typing the above command using "sudo" just enter,




$ sudo !!



and voila, your previous instruction will be executed as root.Note that there is a whitespace between "sudo" and "!!"