opened image

Domain transfer to another user on the same server with VestaCP/HestiaCP

Transferring a domain to another user on the same server with VestaCP or HestiaCP.

Sometimes you need to transfer some sites (domains) to another user on the server. Transferring the site and database from one user in the VestaCP panel to another user may be necessary in many cases, for example, if the first user does not use his account or transfers control of his site and database to another person. Different users on the server may have different levels of access to resources and software, which can affect the performance of the site and database. Therefore, in order to ensure the security and proper functioning of the site and database, a transfer to another user may be necessary. Also, it can be useful when you want to limit server resource usage for a specific user. For example, you provide access to the site to developers or programmers, but you want to provide access not only to the site via ftp, but also to the ssh console, but not to the entire server from the root or admin user. As a result, transferring the site and database to another user may be a necessary step to make sure that the site will work stably and securely, and third-party access will not be granted to third-party programmers. Below is an instruction for performing this operation using the VestaCP panel.

1. Add a new user in the VestaCP server control panel:

Enter the desired name of the new user (Username, First Name, Last Name), password (can be generated) and his mail.

We confirm, and after that a new user will be created in the panel. It will have its home folder /home/USERNAME on the server.

2. Transferring a domain to another user.

To transfer a domain from the default admin user to another user, run the following command from the console on the server:
 

  /usr/local/vesta/bin/v-change-domain-owner DOMAIN USER

Where instead of DOMAIN , USER values you need to specify:
DOMAIN - portable domain
USER - the new user to which the specified DOMAIN is transferred
When executing the command, the web domain, dns domain and mail domain are transferred

Transferring the database to another user:

 

 /usr/local/vesta/bin/v-change-database-owner DATABASE USER

Where instead of DATABASE, USER values you need to specify:
DATABASE - the name of the database to be transferred
USER - the user to which the specified DATABASE is transferred

If after transferring the domain and database to a new user, the site does not work, restart the VestaCP service and/or web services on the server.

 

If commands are not executed as root or there are errors in executing commands, an older version of the VestaCP may be present.

3. HestiaCP control panel.

Let's add a new user in the HestiaCP server control panel. Enter the desired name of the new user (Username, Name), password (can be generated) and his mail.

If you have a HestiaCP control panel, the commands will look like:

v-change-domain-owner DOMAIN USER
v-change-database-owner DATABASE USER

Results.

Transferring a site and database from one user to another is a fairly simple task that can be done by following the instructions above. After the migration is complete, don't forget to restart the VestaCP/HestiaCP service and/or web services if necessary. If you want to migrate the site and database back to the original user, you can follow the procedure above, specifying the original (first) user as the end user.