?
Solved

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

Posted on 2011-03-22
7
Medium Priority
?
2,221 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 800 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 800 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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 12

Assisted Solution

by:upanwar
upanwar earned 400 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 400 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 400 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
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 …
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

719 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