Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a 0

Status
Not open for further replies.

ilovelinux2006

Programmer
Jun 6, 2006
32
US
Hello again,

If I'm editing a copy of my linux systems shadow file /etc/shadow say copy.txt

And the copy.txt reads:

user1:5q0A6GVEFvhf6:12593:0:99999:7:::
user2:9y8sJ8ahtTTTo:12593:0:99999:7:::
user3:NjhahD3GweAkY:12593:0:99999:7:::
user4:w1Ah59F/KAlmA:12593:0:99999:7:::
user5:pFAarOGaLnNIc:12593:0:99999:7:::
user6:6qc77gsfgh2nS/l5I:12593:0:99999:7:::
user7:tU132h9Jnih2Y:12593:0:99999:7:::

Well, if I want to add a 0 to the password section with a command (the 2nd space after the ":"

How would I do that? THANK YOU!!!!!!
 
What if I want to edit a specific user? say just user2 to add the 0 to the password encryption. Thanks feherke!
 
Hi

Are you sure is not this what you want ?
man passwd said:
-l This option is used to lock the specified account and it is
available to root only. The locking is performed by rendering
the encrypted password into an invalid string (by prefixing the
encrypted string with an !).

Feherke.
 
Thanks alot Feherke, you really know your stuff.

If I have a list of users like users.txt:

user1
user2
user3
user4
user5
user6
user7

And I want to do the
passwd -l user1
passwd -l user2

But Have passwd -l (each user in the user.txt)

Thanks!!!!
 
for u in $(<user.txt); do passwd -l $u; done

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
If I copy down:
for u in $(<user.txt); do passwd -l $u; done

It puts
passwd -l user1:5q0A6GVEFvhf6:12593:0:99999:7:::
passwd -l user2:9y8sJ8ahtTTTo:12593:0:99999:7:::
ect:

Any ideas how to put just the user?

Thanks!!!!
 
Seems that your actual user.txt file is not the same as the list of user you posted previously ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top