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
  • 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......
  • Saving401(k) Ripoff? Today, I 'd like to talk about 401(k) fees. Some time back, I saw an interview with John Bogle and read the transcript regarding the high expenses within 401(k) accounts. When this came up in a financial news group, I was told that the data was old, that the fees......
  • blog traffic exchangeMaderas Golf Club, San Diego, California Maderas Golf Club is located in San Diego, California Phone number is 866.413.5634 View Larger Map Website is located at http://www.maderasgolf.com/. About the Course - Maderas golf course was ranked number one for five years straight by the Zagat survey for 2003 to 2007. There is a grand view of......
  • 5mm Tilos Slip-On Boots for Scuba Diving, Snorkeling and all water sports Dive Diver Bootie Boot Snorkel Boat Boating Kayak Rafting Tide Pool 5mm Tilos Slip-On boots for Scuba Diving, Snorkeling and all water sports5mm of neoprene thickness for warmthSuper Stretch - High quality seams for durabilityMolded Sneaker Soles for longevity and rocky beach divesPlease note that these boots run about a 1/2 size large Product DescriptionThis is a great pair of......
  • blog traffic exchangeCan Google challenge Microsoft's dominance in 2010? In 2009, Google Inc. and Microsoft Corp. were fighting for each other's market share and revenue stream by introducing new products and updated versions of existing ones. Various analysts predict that the year 2010 will see more action between the two giants as they compete in the fields of Internet......

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