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
10.20.2009
Rating: -4.50- (out of 5)


Enterprise IT tips and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


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.

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 ...


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Linux monitoring and troubleshooting
Access and repair an ext3 file system with the superblock
Solving Linux server hangs stemming from kernel issues
How to solve logical volume management issues
Troubleshooting Logical Volume Manager boot problems
How to fix master boot record partition table problems
Five Linux commands you have (probably) never heard of
Backing up the Linux master boot record
Fixing Linux boot problems with GRUB
How well do you know Linux commands and tools?
Installing Nagios on Linux and unravelling software code names

Linux administration and management
How to fix master boot record partition table problems
Fixing Linux boot problems with GRUB
Learning the craft of Linux administration with "Pro Linux System Administration"
Troubleshooting Linux boot problems
The Ext4 file system: A real improvement in Linux file storage?
A look at real-world exploits of Linux security vulnerabilities
Using virtualization to reinvent high-performance computing on Linux
Five common Linux security vulnerabilities you may be overlooking
Building a Linux infrastructure with maximum automation
Linux regular expression tutorial

Ubuntu Linux
A unified Linux desktop distribution is the only way to beat Windows
Ubuntu Karmic Koala 9.10 server edition improves cloud functionality
Learn all about Ubuntu in "The Official Ubutu Server Book"
Linux fans see opportunity in Windows 7 changeover
Setting up cloud computing with Eucalyptus
Linux desktop adoption boosted by economy
Ubuntu 9.04 releases improve user experience and enable cloud computing
Ubuntu 9.04 aims for increased data center use
Ubuntu certification on HP ProLiant servers in the works
A step-by-step approach to understanding the Ubuntu Linux System, versions 8.10 and 8.04

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


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 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts