Solved

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

Posted on 2011-03-22
7
1,391 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.

920 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

17 Experts available now in Live!

Get 1:1 Help Now