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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Set A User As NP In /etc/shadow ?

Status
Not open for further replies.

OhNoNotAgain

Programmer
May 21, 2003
6
AU
Hello all,

I need to set a user id in the /etc/shadow file to be NP, e.g.

myuser:NP:::::::

I have to do this via a shell script and NOT by editing the /etc/shadow file. Any ideas how it can be done via the command line ?

Thanks
 
You could set it to *LK* using passwd -l. I'm not sure that's exactly equivalent though.

Alternatively you can 'edit' the /etc/shadow file using ed or sed or similar.

Annihilannic.
 
The official way is...
Code:
    passwd -l username
Hope this helps.

 
Thanks all for the replies ...

I cannot use 'passwd -l username' as that sets the account to *LK* or locked. We are using the latest version of OpenSSH (v3.7.1p2) which does not allow access to locked accounts, hence the required change from *LK* to NP.

I have done quite a bit of research and not found a command line answer other than editing the file using sed as suggested above.

If you know different please let me know. I was really hoping for something like a 'passwd -np username' type command.
 
The NP in the [tt]/etc/shadow[/tt] file stands for No Password. It has the effect of not allowing someone to log into it (i.e. via [tt]telnet[/tt]), but will still allow [tt]root[/tt] to [tt]su[/tt] to it, being that it's not locked.

Hope this helps.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top