Hi
I am looking for script to modify /etc/shadow.
For example:
1-)User enters username
2-)The line of that user is found in /etc/shadow and *LK* is added infront of the second field in /etc/shadow.
How can I do this?
Thanks
Page 1 of 1
modify /etc/shadow
#2
Posted 17 September 2008 - 03:41 AM
Hey There,
This is answered in one other post, also, just use the second version and set the username variable in your shell script:
but, of course, be careful
to get user123 using the -v switch to set the username variable in the shell and transmute it to the awk variable "user"
Hope that helps
, Mike
This is answered in one other post, also, just use the second version and set the username variable in your shell script:
but, of course, be careful
$username=user123
awk -F":" -v user="$username" '{ if ( $0 ~ /user/ ) print $1 ":*LK*" $2 ":" $3 ":" $4 ":" $5 ":" $6 ":" $7 ":" $8 ":" $9}' /etc/shadowto get user123 using the -v switch to set the username variable in the shell and transmute it to the awk variable "user"
Hope that helps
, Mike
The greatest viral marketing idea of all time, get your copy of this Free Report now!
----
Linux Tips, Trick and Advice -- The Linux and Unix Menagerie
----
Linux Tips, Trick and Advice -- The Linux and Unix Menagerie
#4
Posted 18 September 2008 - 02:22 AM
No problem. Happy to help 
Seriously, though - be careful. One mistake and it could mean disaster. Actually, just back up the old one and you should be good (So simple it always evades me until the last second
, Mike
Seriously, though - be careful. One mistake and it could mean disaster. Actually, just back up the old one and you should be good (So simple it always evades me until the last second
, Mike
The greatest viral marketing idea of all time, get your copy of this Free Report now!
----
Linux Tips, Trick and Advice -- The Linux and Unix Menagerie
----
Linux Tips, Trick and Advice -- The Linux and Unix Menagerie
Share this topic:
Page 1 of 1

Help











