LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxAnswers Discussion
User Name
Password
LinuxAnswers Discussion This forum is to discuss articles posted to LinuxAnswers.

Notices


Reply
  Search this Thread
Old 10-23-2005, 09:30 PM   #1
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Post DISCUSSION: How to list all your USERs..


This thread is to discuss the article titled: How to list all your USERs..
 
Old 03-28-2006, 06:58 PM   #2
linuxlinux
LQ Newbie
 
Registered: Mar 2006
Location: Adelaide
Distribution: FreeBSD, Fedora C4, windows Server 2003
Posts: 15

Rep: Reputation: 0
Well when I tried to execute this command this is the answer any idea why has this turned up

[root@unisa ~]# cat /etc/passwd |grep /bin/bash |grep [5-9][0-9][0-9] |cut -d: -f1
Harry
harry
steve
master
help
[root@unisa ~]# alias listuser=cat /etc/passwd |grep /bin/bash |grep [5-9][0-9][0-9] |cut -d: -f1
-bash: alias: /etc/passwd: not found
[root@unisa ~]#
 
Old 03-28-2006, 07:43 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
You need to wrap it in quotes the way they do in the article:
Code:
alias userlist='cat /etc/passwd |grep "/bin/bash" |grep "[5-9][0-9][0-9]" |cut -d: -f1'
 
Old 11-06-2006, 01:09 AM   #4
sysconfig
Member
 
Registered: Sep 2006
Location: (.)
Posts: 44

Rep: Reputation: 15
awk -F":" '{ print "username: " $1 "\t\tuid:" $3 }' /etc/passwd
 
Old 01-11-2008, 12:38 PM   #5
hardened
LQ Newbie
 
Registered: Jan 2008
Posts: 4

Rep: Reputation: 0
Thumbs up great alternate method

Quote:
Originally Posted by sysconfig View Post
awk -F":" '{ print "username: " $1 "\t\tuid:" $3 }' /etc/passwd
Wow! Awesome alternate method. Thx Sysconfig!
awk and gawk are really powerful, I need to spend some time studying them.
 
Old 06-30-2008, 09:16 AM   #6
eponcedeleonc
LQ Newbie
 
Registered: Jun 2008
Posts: 4

Rep: Reputation: 0
how do you list users and passwords? I need to do that.
Thank you
 
Old 06-30-2008, 03:30 PM   #7
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by eponcedeleonc View Post
how do you list users and passwords?
Hmm, so you want a potential security hole that allows any hacker who can get the root password (or even get briefly to a terminal in use by a root user) to get every login password on the system? Are you really sure that's a good idea?

PS: I wouldn't tell you even if I knew. Which I don't.
 
Old 07-01-2008, 02:06 AM   #8
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by eponcedeleonc View Post
how do you list users and passwords? I need to do that.
Being able to list users' passwords would imply that the passwords are stored somewhere on the system, which is not the case. What is stored are salted hashes of the passwords. So unless you've changed something to the standard way GNU/Linux handles user passwords, you won't be able to get any password list.

Last edited by win32sux; 07-01-2008 at 02:07 AM.
 
Old 07-01-2008, 12:07 PM   #9
eponcedeleonc
LQ Newbie
 
Registered: Jun 2008
Posts: 4

Rep: Reputation: 0
well I have a user from another company that has access to the server and DB as root and due to company problems with their company we are going manage the server and DB and i need to know how to block him from having any access to the server and DB.. its just a precaution that needs to be considered, and i dunno if changing the root password would be enough!
 
Old 07-01-2008, 06:25 PM   #10
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by eponcedeleonc View Post
well I have a user from another company that has access to the server and DB as root and due to company problems with their company we are going manage the server and DB and i need to know how to block him from having any access to the server and DB.. its just a precaution that needs to be considered, and i dunno if changing the root password would be enough!
Changing the root password might be enough if you had a way to be sure that he didn't install any sort of backdoor. And you don't have any way to be sure of that unless you did something like take a HIDS snapshot or something before you gave him root access. That said, I'm still not sure how this relates to getting a listing of users' passwords. I mean, you don't need to know that passwords in order to change them. And the guy with root could have easily installed a password sniffer to get everyone's passwords if he wanted them (since cracking the salted hashes would probably be infeasible for him).
 
Old 11-30-2009, 04:54 PM   #11
fatima74
LQ Newbie
 
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by sysconfig View Post
awk -F":" '{ print "username: " $1 "\t\tuid:" $3 }' /etc/passwd
Oh so KEWL, first time I am using awk THANK YOU =)

Did my own variation:
awk -F":" '{ print "Linux_name: " $1 "\t\tFull_Name: " $5 }' /etc/passwd
 
Old 08-02-2012, 11:00 AM   #12
crtlbreak
LQ Newbie
 
Registered: Jan 2012
Distribution: Fedora, Debian & Ubuntu
Posts: 7

Rep: Reputation: Disabled
Wink

Quote:
Originally Posted by eponcedeleonc View Post
well I have a user from another company that has access to the server and DB as root and due to company problems with their company we are going manage the server and DB and i need to know how to block him from having any access to the server and DB.. its just a precaution that needs to be considered, and i dunno if changing the root password would be enough!
It was not designed to allow other people to be given root access.
The security permissions are exactly designed around limiting access to only that which is required to perform the task at hand.
If the other company requires unlimited database access that is alowable through your specific DB admin tool or command?
Regards
 
Old 10-16-2012, 12:48 AM   #13
ylsantosh
LQ Newbie
 
Registered: Oct 2012
Posts: 1

Rep: Reputation: Disabled
How to list all your user

cat /etc/passwd (to display all user )
cat /etc/passwd | wc -l (to count how many user is there ur system )
 
  


Reply



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
What is the command to list users? neo_in_matrix Linux - Newbie 27 11-29-2017 06:09 AM
How to list existing users? stefaandk Linux - Newbie 11 04-03-2006 01:03 AM
How do I list all users (even those not logged in) steved Linux - Newbie 2 09-29-2005 04:45 PM
list out the users. bruse Linux - Newbie 2 07-19-2005 08:46 AM
List all users eam Linux - Newbie 7 05-15-2005 11:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxAnswers Discussion

All times are GMT -5. The time now is 12:40 PM.

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