LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices



Reply
 
Search this Thread
Old 07-25-2003, 10:51 AM   #1
n1wil
LQ Newbie
 
Registered: May 2002
Posts: 20

Rep: Reputation: 0
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
 
Old 07-25-2003, 11:03 AM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
'passwd -l username', I think, though I haven't done it. *g*

'passwd -u' to let them back.
 
Old 07-25-2003, 03:38 PM   #3
Half_Elf
Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 45
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.
 
Old 07-25-2003, 06:11 PM   #4
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create accounts, groups and so on only using the command line? brynjarh Linux - Newbie 2 07-07-2004 02:42 PM
command line user administration?? trey85stang Slackware 6 03-22-2004 12:15 PM
adding a user in the command line Daredevil Linux - Newbie 5 02-27-2004 01:56 PM
Disabling Firewall From Command Line Ben Sytko Red Hat 4 02-16-2004 06:27 PM
Disabling mail accounts Gavin Linux - Networking 3 08-01-2002 11:55 AM


All times are GMT -5. The time now is 06:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration