The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

generate list of shell users via ssh

Discussion in 'General Discussion' started by jdfcomputers, Mar 26, 2006.

  1. jdfcomputers

    jdfcomputers Member

    Joined:
    Apr 12, 2004
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Is there a method where one can generate a list of cpanel users that have shell access via SSH or possibly make a cron job that emails the list of user with SSH access daily.

    Any help would be greatly appreicated, we have several servers and instead of logging into each WHM, an automated script would save us a lot of time.

    JDF
     
  2. Murtaza_t

    Murtaza_t Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    476
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Earth
    cPanel Access Level:
    Website Owner
    That should be simple:
    (Try this, I am not sure if that works and have not tried myself)

    set a cron with :

    Code:
    0  0  *  *  *  cat /etc/passwd | grep /usr/bin/shell | mail -s "Shell users" your@email.com
    try and let me know.
     
  3. maximus_marcus

    maximus_marcus Well-Known Member

    Joined:
    Mar 9, 2006
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    6
    JDF,

    You can use the following command to know the users with the bash shell and then you can go aheah and add this to a file and set it up in the cron to check periodically .

    ###############################

    grep bash /etc/passwd |cut -d : -f1
    ################################

    JailShell
    ========

    #####################

    grep jail /etc/passwd |cut -d : -f1

    #####################


    Let me know if you need any assistance with this .
     
Loading...

Share This Page