Home > Enterprise Linux Tips > > Recovering a lost administration password on Ubuntu Server
Enterprise Linux Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

Recovering a lost administration password on Ubuntu Server


Sander van Vugt, Contributor
Rating: -4.50- (out of 5)

To administer your Ubuntu server, you need administration privileges. The first user you created while installing your server has permission to use the sudo command to perform administration tasks. This isn't true for any of the subsequent users you create. If you delete the admin user account by accident, you lose administrative privileges. Here, you'll learn how to restore administrative access after this has happened.

Keeping your server admin password safe
If haven't experienced the problem of a lost administration password yet, it's a good idea to apply a precautionary measure. The following will help you avoid this:

  1. Log in as the user account with administrative privileges.
  2. Use sudo su to become root.
  3. Use the passwd command to set a password for root. Use a difficult password, but one that you will be sure to remember. Or even better: write it down and save it in a secure place, but don't make a habit of using it. It's for emergencies only.
...

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Heartbeat  (SearchEnterpriseLinux.com)
tty command  (SearchEnterpriseLinux.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


If you lose the password for the user account that can sudo, just login as root and grant this user a new password.

Creating a new admin account
If you're having a problem getting access to your server with administrative privileges and you didn't follow the above procedure, here's how you can gain access again. First, you will log in as root using a rescue CD, and next you will recreate a user that has administrative permissions on your server.

  1. Boot from a rescue CD such as a Knoppix Rescue CD. It doesn't really matter what you use, as long as you can boot Linux and get access to a shell prompt. Make sure to mount the /dev and /proc directories and establish a chroot environment that points to your server's root directory.
  2. You are now root on your server's file system. Use the passwd command to reset the password for the user root. From now on, you have re-established access to the root account.
  3. Reboot your server without the Knoppix CD and verify that you can log in as root, using the password that you've just set.
  4. Recreate an administrative user account that is not root. If for example the name of this user account is linda, use . To use sudo to execute commands as root, you must make sure that the user account is a member of the group adm. To make a user with the name linda member of the group adm, use .
  5. Use to give the user you've just created a password. You have now re-established a user account that can be used to perform administration tasks on your server.

Here we have gone over how to get access to your server after losing access to the admin account. To fix this problem you need physical access to your server and something that boots a Linux shell and allows you to mount your server's file systems.

ABOUT THE AUTHOR: Sander van Vugt is an author and independent technical trainer, specializing in Linux since 1994. Vugt is also a technical consultant for high-availability (HA) clustering and performance optimization, as well as an expert on SLED 10 administration.

Rate this Tip
To rate tips, you must be a member of SearchEnterpriseLinux.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Enterprise Linux Web Server & Application Server
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2010, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts