Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

creating email accounts from ssh

Discussion in 'E-mail Discussion' started by pasqd3, Feb 26, 2011.

  1. pasqd3

    pasqd3 Registered

    Joined:
    Jan 17, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    51
    Hello

    I have a list like 200 accounts name and passes to create in cpanel, Its on one user (in the same domain). Is it possible to create them from ssh ? Doing it via control panel would be a real pain...
     
  2. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    830
    Likes Received:
    26
    Trophy Points:
    178
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    Well, email accounts are stored in /home/$user/etc/$domain/passwd with an associated shadow file in the same folder. So I assume if you can match the formats and hash the passwords (there are perl scripts that can do that), it should work just fine.

    A while back a cpanel staff member wrote a PHP class to let you access API/API2 functions, so if you're proficient in programming you may be able to use it. I don't recall where it is exactly, but I think this is it:

    XML API PHP class version 1.0 - cPanel Integration
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    While the API would be a good way to perform this, there is a script in /scripts/ directory that is /scripts/addpop that has these arguments to create working email accounts:

    Code:
    /scripts/addpop emailuser@domain.com password quota
    Here emailuser is the email username, domain.com is the domain name, password is the email account password, and quota is the size in MB for the email account. You could run a loop through a list of email accounts in a text file to then run the script and have all of these created that way.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. ryan4021

    ryan4021 Registered

    Joined:
    Mar 8, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Website Owner
    The SSH script worked PERFECTLY for creating an account. Is there a similar script function for removing a pop account? Thanks!
     
  5. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    Such a script does exist. It is the following:

    Code:
    /scripts/delpop emailuser@domain.com
    Simply replace emailuser@domain.com with the email address to remove.

    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice