Results 1 to 8 of 8
Hi Frndz
Is there any command to delete all the users at once.
Iam using
#userdel -r 'username'
and it works kool, but i want to delete all the user ...
- 05-07-2009 #1Linux Newbie
- Join Date
- Aug 2008
- Posts
- 119
COMMAND for deleting all usera at once
Hi Frndz
Is there any command to delete all the users at once.
Iam using
#userdel -r 'username'
and it works kool, but i want to delete all the user at once.
Plz help me out of this
Thanks in Advance
- 05-07-2009 #2Just Joined!
- Join Date
- May 2009
- Posts
- 9
why cant it can be done through scripting...
list and for loop can do that
thanks
Rasal
- 05-07-2009 #3Linux Newbie
- Join Date
- Aug 2008
- Posts
- 119
HI rasalp
Its a nice idea but i dont no this scripting and am just new to linux
Can u just help me to do this.
Thanks in Advance
- 05-08-2009 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Rather than giving you the loaded gun, helping put it to your head, and then assisting you to pull the trigger, why don't you tell us why you need to be able to do this?
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 05-08-2009 #5Linux Newbie
- Join Date
- Aug 2008
- Posts
- 119
Hi Rubberman
I am not able to get u.
MY PROB IS I HAVE CREATED 15 USERS IN MY REDHAT-4 AND I WANT TO DELETE ALL THE USERS AT ONCE
If can just help me
Thanks in Advance
- 05-08-2009 #6Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
The Linux OS creates a number of special user accounts automatically. You do not want to delete those. Assuming you are using normal security on your system, then the fastest/easiest way is as root to edit the files /etc/passwd and /etc/shadow, removing the entries for the users you want to delete. Then go to /home and remove their directories and data with the command "rm -rf username".
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 05-08-2009 #7Just Joined!
- Join Date
- May 2009
- Posts
- 6
This solution does not stop you from having to type out the names of all 15 users, but it still prevents you from having to type "userdel" 15 times.
Code:for nnn in user1 user2 user3 user4; do userdel -r $nnn done
- 05-11-2009 #8Just Joined!
- Join Date
- May 2009
- Posts
- 9
Run this script under /home
will delete the users created.
ch=`ls`
ch1="lost+found"
for i in $ch
do
if [ $i = $ch1 ]
then
echo "Could Not Be Deleted"
else
userdel -r $i
echo $i " is deleted"
fi
done


Reply With Quote