Locking specific account without using passwd


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Locking specific account without using passwd
# 1  
Old 09-08-2008
Locking specific account without using passwd

Hey guys just wondering how i could lock a specific acount by prepending LK
to the password field in the /etc/shadow file.

it cannot be done through a command since the script gets called by a menu driven interface so i cant use "passwd". Is there a way where i can search for a specific account then maybe write to the file which the field needs LK?

Its a bash script by the way
thanks
# 2  
Old 09-09-2008
Just use:

Lock account:
passwd -l {username}

Unlock:
passwd -u {username}


The string *LK* will appear in the password field for locked accounts in /etc/shadow
# 3  
Old 09-09-2008
Yehhh but is there a way that i can do it without using passwd -l {username}

like if i can code something to directly modify the shoadow file without using the passwd command

maybe write to the shadow file
# 4  
Old 09-09-2008
Ok, I have to ask, why would you want to do it anyother way.

If you dont have permissions to passwd you wont to /etc/shadow or /etc/passwd
# 5  
Old 09-09-2008
For the project we are doing where not aloud to use any commands like passwd we have to modify the shadow directly they just love making things hard for us Smilie

Im testing it on my own machine as root
# 6  
Old 09-09-2008
On most unixes with a shadow file you'll need to run "pwconv" immediately after a manual edit.
See "man pwconv" an check against your local circumstances.
# 7  
Old 09-15-2008
So is there a way to actually write to the shadow file and prepend LK to the file so you can lock it
without using the commands.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Which process/script is locking account ?

There is a account - ohsuser on Solaris-10 zone. It is getting locked every 2-3 minutes. Can I know, what is process or script, which is using this account and locking it ? root@tswsd23-prdt01:/root# cat /var/adm/messages | tail -10 Sep 24 11:05:53 tswsd23-prdt01 nmo: Excessive (3) login... (5 Replies)
Discussion started by: solaris_1977
5 Replies

2. Solaris

Particular user account shouldn't be locked after entering wrong passwd specfic no. times

Hi all In my system we have implemented user lockout feature after 3 failure attempt if he tries to login directly or if he run the any command through sudo and enter wrong password thrice. Now I have requirement in which particular user account shouldn't be locked when he run the command... (1 Reply)
Discussion started by: sb200
1 Replies

3. AIX

When did AIX start using /etc/security/passwd instead of /etc/passwd to store encrypted passwords?

Does anyone know when AIX started using /etc/security/passwd instead of /etc/passwd to store encrypted passwords? (1 Reply)
Discussion started by: Anne Neville
1 Replies

4. Shell Programming and Scripting

Issue in passing passwd to login into a sudo account

Hi Gurus, I have small issue... I used to pass the passwd for sudo commands like below, gzcat ~/passwd.gz | sudo su - <villin> >> eof ------ ----- ------ eof And it was able to login into "villin" sudo account successfully. But now, I'm using the same in another script for the... (2 Replies)
Discussion started by: raghu.iv85
2 Replies

5. Red Hat

List shell of specific account

Hi everyone. I am wondering how I would accomplish outputting the shell of a specific account on a single line of output. For example I would like to list the shell of 'news' as... /bin/sh providing its current shell is /bin/sh. This probably is a simple answer that I haven't been able to... (2 Replies)
Discussion started by: austinharris43
2 Replies

6. Solaris

passwd cmd reenables passwd aging in shadow entry

Hi Folks, I have Solaris 10, latest release. We have passwd aging set in /etc/defalut/passwd. I have an account that passwd should never expire. Acheived by emptying associated users shadow file entries for passwd aging. When I reset the users passwd using passwd command, it re enables... (3 Replies)
Discussion started by: BG_JrAdmin
3 Replies

7. Solaris

Solaris 10 Kerberos with local account locking

Hello Gurus, I desperately need help to replicate the functionality that I had with Solaris 8 and SEAM into Solaris 10. Our application needs a few users which are created with the application install. One of our customer requires Kerberos as single sign-on because of their IT department... (0 Replies)
Discussion started by: rmaavnii
0 Replies

8. Solaris

ftp account locking

I need some help trying to figure out why our ftp account keeps getting locked with no manual intervention. We have end of day processes that run nightly and the last thing it does is ftp files to a server. Everyonce in a while the script fails because the account has been locked. How could this... (5 Replies)
Discussion started by: morgadoa
5 Replies

9. Shell Programming and Scripting

Looking for specific user ID's from the passwd file

Hello, My issue is that I want to look for specific users that have their first and last initial followed by four numbers. For example: ab1234 I've already got the user ID's out of the passwd file more passwd | awk -F ":" '{print $1}' > userids I just need to know how to just pick... (8 Replies)
Discussion started by: LinuxRacr
8 Replies

10. Solaris

solari s 10 auto account locking

does anyone know in solaris 10, can you lock an account if the user does not change their password within a certain amount of time? What i want to do is, if a user doesnt change their password within 90 days, i want the account locked. This is similar to the redhat linux passwd -i command. ... (3 Replies)
Discussion started by: BG_JrAdmin
3 Replies
Login or Register to Ask a Question