Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-05-2008, 12:53 AM   #1
Registered: Oct 2005
Posts: 321

Rep: Reputation: 32
how to put * in passwd with thousand of character

I have to disable thousand of user and the easiest way to do this is putting (*) in the passwd file.

However, I don't want to do this manually and looking for a bash commands that can out (*) in every user. I'm thinking of "echo" but does it can put (*) in the first character of the users in the passwd file?

Or do you have other suggestions?
Old 06-05-2008, 06:29 AM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
In the first place, you don't want "*" as the first character. Here is an excerpt from the passwd file:
To disable an account, you would put "*" in place of the "x".

Try SED, e.g.
sed -i 's/:x:/:\*:/' /etc/passwd
This disables ALL users, so use it only as a starting point.
Old 06-05-2008, 06:30 AM   #3
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 39
I think you're supposed to put a * in the beginning of the password field, not in the beginning of the line itself. i.e
instead of
Assuming you want it in the password field, the following sed line will replace a * for all lines between 50-100:
sed -ie '50,100s/^\(.*\)\:x/\1:*x/' passwd.test
NOTE: Your file will be overwritten with the changes, so make sure you test it on a backup file first. Change 50,100 to whichever start and end line numbers your range of blocked users lie in.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Thousand Parsec participating in Google Summer of Code LXer Syndicated Linux News 0 03-17-2007 03:31 PM
How to deploy a couple thousand images for free. williamwbishop Linux - Enterprise 9 11-30-2005 04:24 AM
Permedia 2, a thousand and 1 problems saturn_vk Linux - Hardware 1 04-17-2004 01:03 PM
dual boot - one thousand questions ulrik Linux - Software 6 04-15-2004 07:40 PM
100 thousand, OR 500 Thousand first? MasterC General 23 10-05-2003 12:05 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:42 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration