Results 1 to 5 of 5

Thread: creating email accounts from ssh

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    2

    Default creating email accounts from ssh

    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. #2
    Registered Member cPanel Partner NOC Badge vanessa's Avatar
    Join Date
    Sep 2006
    Location
    Virginia Beach, VA
    Posts
    732
    cPanel/WHM Access Level

    DataCenter Provider

    Default Re: creating email accounts from ssh

    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

  3. #3
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,610
    cPanel/WHM Access Level

    Root Administrator

    Default Re: creating email accounts from ssh

    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.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  4. #4
    Registered User
    Join Date
    Mar 2012
    Posts
    1
    cPanel/WHM Access Level

    Website Owner

    Default Re: creating email accounts from ssh

    Quote Originally Posted by cPanelTristan View Post
    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.
    The SSH script worked PERFECTLY for creating an account. Is there a similar script function for removing a pop account? Thanks!

  5. #5
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,610
    cPanel/WHM Access Level

    Root Administrator

    Default Re: creating email accounts from ssh

    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!
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads

  1. Creating simple ssh accounts
    By spiritguardian in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 08-06-2007, 10:17 AM
  2. Creating email accounts
    By cpaneluser1 in forum E-mail Discussions
    Replies: 3
    Last Post: 04-03-2006, 11:58 AM
  3. Creating multiple email accounts
    By tariq99 in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 08-28-2005, 04:17 AM
  4. creating mail accounts via ssh
    By triatma in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 02-20-2004, 03:48 PM
  5. Manually creating new email accounts
    By TCSLEA in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 12-04-2003, 01:36 PM
bargain