Solved

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

Posted on 2011-03-22
7
1,309 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now