How to delete User from the Command line

Deleting a user might occasionally become necessary. You should clean up any unused accounts when someone stops using your computer—or when you decide to stop letting someone use it! You can delete a user either from the command line or by using YaST, as described in the following sections.

The userdel command allows you to delete users. It undoes most, but not all, of what the useradd command does.See the steps below for instructions.

1. Before you remove a user, take note of the user’s ID number since you may need to know this later. Look at the third field of the user’s entry in /etc/passwd. For example, you can see in this line from the password file that user joe has user ID 100:

joe:x:100:100: :/home/joe:/bin/bash

2. As root, run the userdel command with the username of the user you wish to remove. (Keep in mind that you cannot remove an account if the user is logged in.)

3. By default, userdel will not remove any of the user’s files. To remove the user’s home directory automatically, use the -r option. For example:

# userdel -r joe

If you do not use the -r option, you will need to remove the user’s home directory manually:

# rm -rf /home/joe/

The user may have other files on the system which userdel has not removed. Particularly, look in the /var/spool directory. You might want to remove old mail, for example. Also, the user may have installed a crontab file. Here is how you would remove these things:

# rm fvarfspooi/mail/joe
#rm Ivarlspooilcronltabs/joe

4. It is possible that the user still has some jobs running. Rather than rebooting, you can search for and kill any jobs left running by the user. The user no longer exists in the password file so you cannot search by the user’s name. Instead, search for jobs owned by the user ID you found in Step 1. Here is an example of killing a job that Joe left running:

# ps —user 100

PID TTY TIME CMD

1490 ? 00:06:21 mydaemon

# kill —9 1490

Furnace Prices Winnipeg

Furnasman One Hour CBC

CBC News: Consumer Life-Concerns raised about furnace company

www.adgerlinux.com

Blog Traffic Exchange Related Websites
  • blog traffic exchangeThe Benefits of Joining a Gym You may have tried several times to begin a workout regime at home, and haven’t stuck with it. Or, you simply do not know what to do to get into shape. Purchasing a treadmill didn’t work and it got old after awhile. You may also feel like you have no......
  • Nokia N900Review: Nokia N900 [/caption] Product summary The good: The Nokia N900 offers a powerful mobile Web browser, plenty of storage, a 5-megapixel camera, and an ultrasharp display. It's also fast, multitasks well, and has excellent call quality. Wi-Fi, 3G, Bluetooth, and GPS are all onboard. The bad: The user interface isn't very intuitive.......
  • Butterfly 8252 Derek May Table Tennis RacketButterfly 8252 Derek May Table Tennis Racket User Reviews Send this to a friend Butterfly 8252 Derek May Table Tennis Racket Manufacturer: Martin Kilpatrick Customer Rating: List Price: $34.99 Sale Price: $28.99 Availibility: Usually ships in 1-2 business days Buy Now Product Description With a rubber and sponge combo that offers spin, speed, and control, the......
  • scratchbeginnings062909A New Perspective On Meeting Basic Needs Last week I mentioned that I was reading the book Scratch Beginnings: Me, $25, and the Search for the American Dream, by Adam Shepard. The book chronicles the real-life journey of Shepard, who upon finishing college turned over all his worldly possessions to his brother, and began a social experiment......
  • blog traffic exchangeImprove Website with Quality Steps - Must Read Numerous factors are there to improve your website in terms of quality. First of all, the visitors to you site could see useful content and they should feel comfortable to take the services offers from your website.  If you are looking for the steps to improve the quality of......

Tags: , , , , , , , , , , , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply