Solved

can I comment out a user in /etc/passwd ?

Posted on 2011-03-22
7
1,524 Views
Last Modified: 2012-08-14
I have a user that "appears" to be created with root privs.  

I want to get rid of the account but want to be able to undo what I did  easly in case I am wrong.  

Can I just put a # in front of the line  ??

0
Comment
Question by:TIMFOX123
7 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 200 total points
ID: 35188880
Yes, you can.  It would fail the authentication of the user.

You can also comment it in /etc/shadow file

This should effectively restrict the user.

A better way would be to lock the account.  That can be done with either chage or usermod commands.

You can simply put "!" in the password field in the /etc/shadow file.  That would effectively block the user
0
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 200 total points
ID: 35188889
If you want to be aware of all the files user has on the system, you can issue the command

find / -user <userid>
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35188896
Locking user:

usermod -L userID

Open in new window

0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 12

Assisted Solution

by:upanwar
upanwar earned 100 total points
ID: 35188906
No you can not but you can disable that user.

simply prefix the ``*'' asterisk character in front of the encrypted password to disable the account, and simply removing the asterisk to enable it.
0
 
LVL 14

Assisted Solution

by:svgmuc
svgmuc earned 100 total points
ID: 35188927
Commenting out might work with your very Linux system but it should generally be avoided. You might get used to doing it and it could easily break other Unix/Linux systems.
Locking the account or replacing the password hash is the recommended way, as explained by farzanj and upanwar.
0
 
LVL 6

Assisted Solution

by:mohansahu
mohansahu earned 100 total points
ID: 35197519
linux locking an account use the below syntax.

Syntax:
passwd -l {username}

0
 

Author Closing Comment

by:TIMFOX123
ID: 35197657
Thank you all !!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question