Skip to main content

Add Domain via ssh?

Comments

30 comments

  • cPanelLauren
    Hi @xata11 You could try using the cpapi2 here cPanel API 2 Functions - AddonDomain::addaddondomain - Developer Documentation - cPanel Documentation but I can't guarantee it will work without the proper cPanel Licensing added to the server.
    0
  • xata11
    Hi @
    0
  • cPanelLauren
    As I mentioned before there was no guarantee it would work. In order to move forward, you'll need to renew your license.
    0
  • Elkarouani Salah Eddine
    without using a cpanel api, what is the solution to create a domaine via ssh commands ?
    0
  • cPanelLauren
    Without using the API you can run the following to create a new account: [root@server ~]# /scripts/createacct --help Please use the following syntax: createacct
    But this is essentially just using the API, why wouldn't you want to use it?
    0
  • Elkarouani Salah Eddine
    i run the command : /scripts/createacct --help but it returns : /scripts/acc: No such file or directory is there anything i mess ?
    0
  • cPanelLauren
    based on that output it doesn't sound like you ran the script properly: /scripts/acc
    The script is /scripts/createacct not /scripts/acc You may also want to call the full path: /usr/local/cpanel/scripts/createacct
    0
  • Elkarouani Salah Eddine
    i tried both of them but getting the same message of "No such file or directory"
    0
  • cPanelLauren
    Do you have cPanel/WHM installed and are you logged in as the root user?
    0
  • Elkarouani Salah Eddine
    i access to my cpanel account via ssh and i want to create domains on it, i use Putty for this moment, so from there i can create subdomains for a domain and creating new databases, in order to create new domains, is there anything i can do ? and what you mean by having cPanel/WHM installed ?
    0
  • cPanelLauren
    Are you accessing as the root user or as a cPanel user? As a cPanel user you'd only be able to add addon domains as well as subdomain using the cpapi2/UAPI (/scripts/ won't work as the cPanel user) To create an addon domain: cPanel API 2 Functions - AddonDomain::addaddondomain - Developer Documentation - cPanel Documentation cpapi2 --user=username AddonDomain addaddondomain dir=addondomain%2Fhome%2Fdir newdomain=addondomain.com subdomain=subdomain
    To create a subdomain: cPanel API 2 Functions - SubDomain::addsubdomain - Developer Documentation - cPanel Documentation cpapi2 --user=username SubDomain addsubdomain domain=subdomain rootdomain=example.com dir=%2Fpublic_html%2Fdirectory_name disallowdot=1
    To park a domain: cPanel API 2 Functions - Park::park - Developer Documentation - cPanel Documentation cpapi2 --user=username Park park domain=example.com topdomain=subdomain
    0
  • Elkarouani Salah Eddine
    I tried to use that command of cpapi2 on putty, but i got that command not found, is there something messing here ?
    0
  • cPanelLauren
    @Elkarouani Salah Eddine My assumption is that you don't have privileges to do so, I'd suggest contacting your provider for further assistance.
    0
  • Elkarouani Salah Eddine
    how to make this cpapi2 command works, what it needs to work ? can you explain more ? And what can be these privileges ?
    0
  • cPanelLauren
    Without knowing your configuration and/or how you're logging into the server it's difficult to tell you what is occurring. If you'd like to tell me what the user is you're using to access the server as well as the access level you have it may be easier.
    0
  • Elkarouani Salah Eddine
    i am using the user : frbbfkyb
    0
  • sparek-3
    You probably don't have the path to cpapi2 in your shell PATH environment variable. Try using the full path [plain]/usr/local/cpanel/bin/cpapi2 --user=username AddonDomain addaddondomain dir=addondomain%2Fhome%2Fdir newdomain=addondomain.com subdomain=subdomain[/plain] I'm not really sure why cPanel insists on never mentioning this in these forums. Although, I suppose it's not really their place to define what you have your PATH variable set to.
    0
  • cPanelLauren
    I'm not really sure why cPanel insists on never mentioning this in these forums. Although, I suppose it's not really their place to define what you have your PATH variable set to.

    It is noted in the documentation I linked and it's only commonly necessary when running CloudLinux i am using the user : frbbfkyb
    As this user with SSH access you should be able to run cpapi2/UAPI function though you shouldn't need to specify the user in this case. You can try with the full path as well by running something like the following: /usr/local/cpanel/bin/cpapi2 AddonDomain addaddondomain newdomain=yourdomain.tld subdomain=yourdomain
    0
  • Elkarouani Salah Eddine
    i am happy to tell you that i found cpapi2 whene i used this command : /usr/local/cpanel/bin/cpapi2 But suddenly i get that Cpanel.pm in @INC and that i may need to install the Cpanel module How is that ? Also when i used the last command you sent : /usr/local/cpanel/bin/cpapi2 AddonDomain addaddondomain newdomain=yourdomain.tld subdomain=yourdomain It returns the following message : warn [cpapi2] failed to execute /usr/local/cpanel/cpanel: No such file or directory at /usr/local/cpanel/Cpanel/XML.pm line 111
    0
  • cPanelLauren
    This will need to be addressed with your provider in that case. Without root access to the server, you won't be able to make any of the changes that would be necessary to resolve this.
    0
  • Elkarouani Salah Eddine
    how would be this root access like example ? can you explain more about this access ?
    0
  • cPanelLauren
    Hello @Elkarouani Salah Eddine Having root access means that you'd have full control and be able to manage all aspects of the server including WHM - not just cPanel user access.
    0
  • Elkarouani Salah Eddine
    I get your point, but i have just cpanel account from planet hoster, i don't have an idea about accessing to WHM too Can i use WHM from planet hoster that gives me a cpanel account ?
    0
  • Infopro
    It sounds to me like you do not have root access to the server that your account is on. Without root or Reseller access, you would not be able to access WebHost Manager.
    0
  • Elkarouani Salah Eddine
    It seems to be that i can create at least addon domains from cpanel control pannel, why i can't do that via ssh without using the cpapi2 command ?
    0
  • Infopro
    It seems to be that i can create at least addon domains from cpanel

    Did you get your cPanel license renewed?
    0
  • Elkarouani Salah Eddine
    I don't have an idea about this cPanel license
    0
  • Infopro
    Ah, my mistake. This thread was orginally started by someone else.
    0
  • Elkarouani Salah Eddine
    It seems to be that i can create at least addon domains from cpanel control pannel, why i can't do that via ssh without using the cpapi2 command ?

    so what is the reason ?
    0
  • cPanelLauren
    so what is the reason ?

    This is why you need to discuss this with your provider, you get an error when running the cpapi2 function, this isn't something we can assist you with without root access. Either your provider has made customizations or there is an issue on the server, either way you can't resolve the issue, they must.
    0

Please sign in to leave a comment.