Wednesday, March 14, 2012

ubuntu root password

Where is root?

Ubuntu developers made a conscientious decision to disable the administrative root account by default in all Ubuntu installations. This does not mean that the root account has been deleted or that it may not be accessed. It merely has been given a password which matches no possible encrypted value, therefore may not log in directly by itself.
Instead, users are encouraged to make use of a tool by the name of sudo to carry out system administrative duties. Sudo allows an authorized user to temporarily elevate their privileges using their own password instead of having to know the password belonging to the root account. This simple yet effective methodology provides accountability for all user actions, and gives the administrator granular control over which actions a user can perform with said privileges.
  • If for some reason you wish to enable the root account, simply give it a password:

    sudo passwd root
     
    Sudo will prompt you for your password, and then ask you to supply a new password for root as shown below:

    [sudo] password for username: (enter your own password)
    Enter new UNIX password: (enter a new password for root)
    Retype new UNIX password: (repeat new password for root)
    passwd: password updated successfully 
     
    *** For Ubuntu 12.04 LTS need to execute one more command to enable root user:
            : sudo sh -c 'echo "greeter-show-manual-login=true" >> /etc/lightdm/lightdm.conf'.

          Now Reboot you system in Users List you will have Login option select that enter root click
          enter then it will ask for password enter password and hit enter. Now you logged as a root user
          (Note: At a times UserName will not display as root. Open terminal and look for the username there
          it will be showing as root).
     
     
  • To disable the root account, use the following passwd syntax:

    sudo passwd -l root 
     
  • You should read more on Sudo by checking out it's man page:

    man sudo
    
By default, the initial user created by the Ubuntu installer is a member of the group "admin" which is added to the file /etc/sudoers as an authorized sudo user. If you wish to give any other account full root access through sudo, simply add them to the admin group.

Adding and Deleting Users

The process for managing local users and groups is straight forward and differs very little from most other GNU/Linux operating systems. Ubuntu and other Debian based distributions, encourage the use of the "adduser" package for account management.
  • To add a user account, use the following syntax, and follow the prompts to give the account a password and identifiable characteristics such as a full name, phone number, etc.
    sudo adduser username
    
  • To delete a user account and its primary group, use the following syntax:
    sudo deluser username
    
    Deleting an account does not remove their respective home folder. It is up to you whether or not you wish to delete the folder manually or keep it according to your desired retention policies.
    Remember, any user added later on with the same UID/GID as the previous owner will now have access to this folder if you have not taken the necessary precautions.
    You may want to change these UID/GID values to something more appropriate, such as the root account, and perhaps even relocate the folder to avoid future conflicts:
    sudo chown -R root:root /home/username/
    sudo mkdir /home/archived_users/
    sudo mv /home/username /home/archived_users/
    
  • To temporarily lock or unlock a user account, use the following syntax, respectively:
    sudo passwd -l username
    sudo passwd -u username
    
  • To add or delete a personalized group, use the following syntax, respectively:
    sudo addgroup groupname
    sudo delgroup groupname
    
  • To add a user to a group, use the following syntax:
    sudo adduser username groupname