LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-05-2008, 12:53 AM   #1
packets
Member
 
Registered: Oct 2005
Posts: 324

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, 01:27 AM   #2
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
whr do u want to exactly put * in /etc/passwd file ?
pls give an example
 
Old 06-05-2008, 01:37 AM   #3
packets
Member
 
Registered: Oct 2005
Posts: 324

Original Poster
Rep: Reputation: 32
I want to put the (*) in the first line

E.g.

admin:x:500:500::/home/admin:/bin/bash

I want it to be

*admin:x:500:500::/home/admin:/bin/bash
 
Old 06-05-2008, 01:45 AM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
As per my understanding you need this,

say look for user root in /etc/passwd and put a * in front of it.


Quote:
cat /etc/passwd | grep root | sed 's/root/* &/'
this will give you this output.
Quote:
* root:x:0:0:root:/root:/bin/bash
Hope this helps.

For all file modifications, learn sed. Its a wonderful utility.
This is the link.
http://www.grymoire.com/Unix/Sed.html

Last edited by vikas027; 06-05-2008 at 01:47 AM.
 
Old 06-05-2008, 05:42 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.3
Posts: 17,548

Rep: Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423
Actually, put a '!' or '*' in the passwd field: http://linuxhelp.blogspot.com/2005/1...ing-users.html
 
  


Reply


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
how to put * in passwd with thousand of character packets Linux - Newbie 2 06-05-2008 06:30 AM
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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:06 PM.

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