Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-25-2003, 09:51 AM
|
#1
|
LQ Newbie
Registered: May 2002
Posts: 20
Rep:
|
disabling user accounts via command line
Hi,
I wish to temporarily disable a user account instead of deleting it.
Is there a way this can be done from the command line? I have SSH root access to the box.
Any help would be appreciated.
Thanks,
~ John
|
|
|
07-25-2003, 10:03 AM
|
#2
|
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113
Rep:
|
'passwd -l username', I think, though I haven't done it. *g*
'passwd -u' to let them back.
|
|
|
07-25-2003, 02:38 PM
|
#3
|
LQ Guru
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163
Rep:
|
add a "*" in /etc/shadow instead of the encrypted password
this will prevent them to log in. Of course, save the encrypted password somewhere safe then.
|
|
|
07-25-2003, 05:11 PM
|
#4
|
LQ Guru
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339
Rep:
|
Here is what I've found at Slackware homepage:
Disabling a User
Disabling an account is easy and sometimes preferrable in certain situations. From the passwd(1) man page:
User accounts may be locked and unlocked with the -l and -u flags. The -l option disables an account by changing the password to a value which matches no possible encrypted value. The -u option re-enables an account by changing the password back to its previous value.
Removing a User
Removing a user requires editing a few files and removing some things, but it's really quite simple. These steps a necessary to remove a user from the system:
1. Remove the line in /etc/passwd. As root open the file /etc/passwd and find the line corresponding to the account you are removing and delete it.
2. Remove the user name from /etc/group. You need to remove the username from any groups in the /etc/group file.
3. Remove the line in /etc/shadow. Same process as in step 1.
4. Delete the home directory. As root do an rm -rf on the home directory for the account.
5. Delete the mail spool file. As root you need to delete /var/spool/mail/{USERNAME}.
Another approach to removing a user is by using the userdel command (located in /usr/sbin). You can use it to do all of the above. See the man page for more information.
Adding a User
Slackware Linux makes adding a new user easy. All you have to do is run the /usr/sbin/adduser script. It will present you with a series of questions and then it will complete all of the necessary steps to get the account working.
After the account is setup, you can use the following programs to manage the account:
* /usr/bin/passwd - Changes the password.
* /usr/bin/chfn - Changes the finger information.
* /usr/bin/chsh - Changes the user's login shell.
|
|
|
All times are GMT -5. The time now is 10:36 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|