LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   LinuxAnswers Discussion (http://www.linuxquestions.org/questions/linuxanswers-discussion-27/)
-   -   DISCUSSION: How to list all your USERs.. (http://www.linuxquestions.org/questions/linuxanswers-discussion-27/discussion-how-to-list-all-your-users-376204/)

amitsharma_26 10-23-2005 09:30 PM

DISCUSSION: How to list all your USERs..
 
This thread is to discuss the article titled: How to list all your USERs..

linuxlinux 03-28-2006 06:58 PM

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 ~]#

gilead 03-28-2006 07:43 PM

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'

sysconfig 11-06-2006 01:09 AM

awk -F":" '{ print "username: " $1 "\t\tuid:" $3 }' /etc/passwd

hardened 01-11-2008 12:38 PM

great alternate method
 
Quote:

Originally Posted by sysconfig (Post 2492173)
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.

eponcedeleonc 06-30-2008 09:16 AM

how do you list users and passwords? I need to do that.
Thank you

salasi 06-30-2008 03:30 PM

Quote:

Originally Posted by eponcedeleonc (Post 3199293)
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.

win32sux 07-01-2008 02:06 AM

Quote:

Originally Posted by eponcedeleonc (Post 3199293)
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.

eponcedeleonc 07-01-2008 12:07 PM

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!

win32sux 07-01-2008 06:25 PM

Quote:

Originally Posted by eponcedeleonc (Post 3200462)
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).

fatima74 11-30-2009 04:54 PM

Quote:

Originally Posted by sysconfig (Post 2492173)
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

crtlbreak 08-02-2012 11:00 AM

Quote:

Originally Posted by eponcedeleonc (Post 3200462)
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

ylsantosh 10-16-2012 12:48 AM

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 )


All times are GMT -5. The time now is 07:13 AM.