LinuxQuestions.org
Help answer threads with 0 replies.
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 02-14-2012, 07:53 AM   #1
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
Question User account locking questions


userdel man page says:

Quote:
CAVEATS
userdel will not allow you to remove an account if there are running processes which belong to this account. In that case, you may have to kill those processes or lock the user's password or account and remove the account later.
How do I lock an user account or password? Only with usermod -L?

When I want to stop an user from logging into a system, but keep his files (e.g., to be analysed or just kept), is one of these best or bad?

- just locking the account, or
- remove his account but keeping his files, or
- backup his files and removing the user completely

What choices would have the same steps across most flavors of systems?
 
Old 02-14-2012, 08:02 AM   #2
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Locking the account should prevent login. Off hand, I think you could also set the login terminal to /bin/false and accomplish the same thing. A simple option would be, as root, to change their password to something that they would have an extremely hard time guessing.
 
1 members found this post helpful.
Old 02-14-2012, 08:08 AM   #3
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Hi dedec0,

It is always a good practice to remove the user account when you know that this account will not be used in future. However, if you have scenario wherein there are chances of that user coming back then it is better to keep his account disabled for that time frame.

Let me put it in simple way. Disable the user account using usermod -L for a month. If that user does not comes back then delete the user account. Ofcourse you have to maintain a sheet which will keep a record when you have disabled the user account and when you should delete it.

It is always a good idea to retain the data belongs to the user you will going to delete for audit purpose. You can find out the files that were owned/created by the user using find / -user <username> command.

Procedure will look like as follows:

1. Disable the user account and keep it disabled for a month.
2. If your comes back within a month re-enable the account, reset the password and give credential to the user.
3. If user does not comes back then find out all the files owned/created by him using find command. Make a copy of it under some backup directory and delete the user account.
 
1 members found this post helpful.
Old 02-14-2012, 09:34 AM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Cleaning up when a user leaves.

Quote:
Originally Posted by dedec0
What choices would have the same steps across most flavors of systems?
I have a procedure that I follow on both GNU/Linux and FreeBSD systems. (Note that - for FreeBSD - some commands differ from what I'll post below.) As a general rule, I do not remove old accounts. UIDs are preserved/retired when users leave, for auditing purposes.

Eliminate shell login ability

Code:
# passwd -l joe

# chsh -s /sbin/nologin joe
Cut off home directory access

Code:
# mv /home/joe /home/joe.gone

# chown root /home/joe.gone

# chmod go-rwx /home/joe.gone
Check for scheduled jobs

Code:
# crontab -u joe -l

# atq
Remove sudoer privileges

Code:
# visudo
Check for running processes

Code:
# ps aux | grep '^joe'
Find owned files

Code:
# find / -user joe > joe-files
(You'll need to make a determination about which to keep, change ownership on, remove, etc.)

Last edited by anomie; 02-14-2012 at 09:35 AM.
 
2 members found this post helpful.
  


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 to track account disabling / password locking Atnor Red Hat 1 02-26-2008 06:19 PM
Prevent user account from logging in but allow su to account DejaCpp Linux - General 4 07-26-2006 11:44 AM
User Account to Access Another Account benfaust Linux - General 2 06-28-2006 12:26 PM
is it legitimate and allowed and can be done to make another user account set uid and gid to null 0 to make another root account with different name and possibly not damage the debian system creating and using that new account BenJoBoy Linux - Newbie 12 01-29-2006 10:02 AM
Networking command line/user account questions daburz Linux - Networking 1 06-20-2004 09:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:24 AM.

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
Open Source Consulting | Domain Registration