listing users on a server


Results 1 to 7 of 7

Thread: listing users on a server

  1. #1
    Join Date
    Apr 2005
    Location
    Fredonia, NY
    Posts
    73

    listing users on a server

    Hi, I was wondering if there was any way to list the users with an account on a server? I have an account on a UNIX server at my college, and I was wondering if I could get a list of account names on the command line so that I don't have to ask a bunch of teachers what their user name is to send them messages or anything. Thanks a lot

  2. #2
    Join Date
    Aug 2001
    Location
    Somewhere, Texas
    Posts
    9,628
    'finger' is a great app for that, if it's installed.

    /etc/passwd will also have the users

  3. #3
    Join Date
    Apr 2005
    Location
    Fredonia, NY
    Posts
    73
    when i try the /etc/passwd it tells me permission denied. im only a local user, i dont have access to root. im still new to the unix environment, so i dont know lots about the command line. any other suggestions?

  4. #4
    Join Date
    Apr 2003
    Location
    Buenos Aires, Argentina
    Posts
    4,221
    Most of the users have home directories, they're usually in /home. You may want to try to list its contents.
    djserz.com.ar
    "All the drugs in this world won't save you from yourself..."

  5. #5
    Join Date
    Jan 2004
    Location
    linuxjunkies.in
    Posts
    19
    As most of the users home directory are placed in the /home, you can simply count the directories to get a number, provided you have read permission on the /home.

    Fire in
    Code:
    ls -l /home | wc -l
    it will give you a number close to the actual user count.
    Loving GNU/Linux >>>>>A GNU/Linux Fanatics' Group
    Free Hosting for GNU/LINUX User Groups >>>>> Swatantranet.com

  6. #6
    Join Date
    Mar 2003
    Location
    Earth [I think...]
    Posts
    414
    Try using
    Code:
    cat /etc/passwd
    to output the password file. All users usually have read access to this file so the above command should work.

    Or you could use finger.

    Hope this helps.

    - Suramya
    --------------------------------------------------
    My Website: http://www.suramya.com
    My Blog: http://www.suramya.com/blog
    Registered Linux User #: 309391
    --------------------------------------------------

    *************************************************
    Disclaimer:
    Any errors in spelling, tact, or fact are transmission errors.
    *************************************************

  7. #7
    Join Date
    Apr 2001
    Location
    SF Bay Area, CA
    Posts
    14,947
    Or, if you want just the usernames (not the home directories, shells, extended info, etc.), you can do it with cut:

    cut -d: -f1 /etc/passwd

    The -d: argument tells cut to use the : character as its delimiter, and the -f1 argument tells cut to print only the first field. (Fields are delimited by the delimiter, just in case that's not obvious from the name. )

    Also note that not everything in /etc/passwd is necessarily a human user, either. A lot of daemons use a special restricted user to run as -- openssh, Apache, and BIND can all be configured to do that. So you might have to do some manual or semi-manual filtering on this list, but it should get you close.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •