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
CBC News: Consumer Life-Concerns raised about furnace company
www.adgerlinux.com
Related Websites -
Maderas 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...... -
Can 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...... -
West Virginia@South Florida Game Preview West Virginia----The Mountaineers have averaged 15.0 points in their last three games against the Bulls, going 1-2. West Virginia won 13-7 at home last season despite being outgained 326-280. West Virginia's conference-best running game has keyed the Mountaineers' current four-game winning streak, as Devine is averaging 148.0 yards per game...... -
Is Wreckovating Worth It? If you are considering changing your home, it is important to decide if “wreck-o-vating” or the process of completely tearing apart a room and redoing it entirely is worth the effort. There are many opponents to wreckovating, but in some cases, this style of renovating may be necessary. Here is...... -
Review: 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.......
Tags: Delete, Furnace Prices, Home Directory, Job, Jobs, Mail, Password File, Pid, Ps User, Rf, Running, Step 1, Unused Accounts, Winnipeg
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.
Leave a Reply