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

User account status questions? 1

Status
Not open for further replies.

cpjust

Programmer
Sep 23, 2003
2,132
US
Hi,
I know the basics of using a UNIX environment, but I'm not quite sure how to do these types of things...

I saw the useradd, userdel, passwd and usermod commands, which look like they do some of the things I need, but not all. Here are the different user status operations I need to do:

Add User - Use useradd.
Delete User - Use userdel.
Change Password:
Administratively (& expire password) - Use passwd with username?
As a user - Use passwd without username?
Administratively Disable User: - ???
Lock Account as a user - Try logging in with bad password x times.
Administratively Enable User - ???
Unlock Account - ???
List the current status of account (i.e. Locked, Disabled, Expired Password...) - ???

Can someone help me fill in the gaps for the operations listed above?
 
Thanks.
When I look at the man info for usermod, it says:
-l login_name
The name of the user will be changed from login to
login_name. Nothing else is changed. In particu-
lar, the user's home directory name should probably
be changed to reflect the new login name.

-u uid The numerical value of the user's ID. This value
must be unique, unless the -o option is used. The
value must be non-negative. Values between 0 and
99 are typically reserved for system accounts. Any
files which the user owns and which are located in
the directory tree rooted at the user's home direc-
tory will have the file user ID changed automati-
cally. Files outside of the user's home directory
must be altered manually.
How does changing the login name and UID affect the user's disabled/enabled status?

Also, once I change a user's status, how do I check to see if they're disabled or have an expired password...? I tried using finger, but that doesn't give me the info I need.
 
I'm sorry, I was doing that from memory. you're right..

The correct parameters are the capital letters for "L" and "U"... thus "usermod -L" and "usermod -U"... also in the man page I expect.

Sorry for the confusion.

D.E.R. Management - IT Project Management Consulting
 
Thanks, those look like they should cover the Disable/Enable cases.

Now, how do I find out the current status of a user? I didn't see any sort of userlist command that shows me if a user is Disabled or not...
 
OK thanks.
I can probably use the info in the redhat link to write a quick little program that reads the info from the shadow file...
 
passwd -S username

Seems to be helpful. Except it doesn't allow a list as input.

passwd -S `cat /etc/passwd | cut -d: -f 1`

failed for me and told me it only accepts 1 line at a time.

(ofcourse it's not that hard to find a trick around that)

Good luck,

Ted Kraan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top