Add Domain via ssh?
Please I need help, I need to add new domain virtual host to my server. I have cpanel install but licience has already expire, I don't have any cash on me right now. In other to add new domain to my current one under public_html, I edited apache2 httpd.conf but its still now working, is there any other place i need to edit, in other to achieve this, I really need to add some addon domain via ssh
-
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 -
As I mentioned before there was no guarantee it would work. In order to move forward, you'll need to renew your license. 0 -
without using a cpanel api, what is the solution to create a domaine via ssh commands ? 0 -
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 -
i run the command : /scripts/createacct --help but it returns : /scripts/acc: No such file or directory is there anything i mess ? 0 -
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/createacct0 -
i tried both of them but getting the same message of "No such file or directory" 0 -
Do you have cPanel/WHM installed and are you logged in as the root user? 0 -
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 -
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 Documentationcpapi2 --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 Documentationcpapi2 --user=username Park park domain=example.com topdomain=subdomain0 -
I tried to use that command of cpapi2 on putty, but i got that command not found, is there something messing here ? 0 -
@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 -
how to make this cpapi2 command works, what it needs to work ? can you explain more ? And what can be these privileges ? 0 -
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 -
i am using the user : frbbfkyb 0 -
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 -
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 CloudLinuxi 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=yourdomain0 -
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 -
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 -
how would be this root access like example ? can you explain more about this access ? 0 -
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 -
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 -
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 -
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 -
It seems to be that i can create at least addon domains from cpanel
Did you get your cPanel license renewed?0 -
I don't have an idea about this cPanel license 0 -
Ah, my mistake. This thread was orginally started by someone else. 0 -
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 -
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.
Comments
30 comments