Only admins have the authority to change the username of a DirectAdmin account. However, the tool to alter a username has been removed from the DirectAdmin interface since April 2021.
In this tutorial, we will show you how to do it via SSH access.
Warning: Changing the username will make all data for that account inaccessible. That is why we recommend you take a full data backup before proceeding.
To Change Username
1. Confirm if the new username is available. Run the following command to check:
# cat /etc/passwd | grep NEWUSERNAME
If it is available and ready to use, you will get an empty response.
2. Change the username with these commands:
# cd /usr/local/directadmin/scripts # ./change_username.sh OLDUSERNAME NEWUSERNAME
DirectAdmin will change the username in this way:
[root@test /]# cd /usr/local/directadmin/scripts
[root@test scripts]# ./change_username.sh oldusername newusername
Killing User processes:
[root@test scripts]#
3. To confirm, rerun the cat command:
# cat /etc/passwd | grep NEWUSERNAME
This time, the result will look something like this:
newusername:x:1243:1246::/home/newusername/bin/false
[root@test scripts]#
4. Reconfigure the settings for your website.
- Change the path of the hosting account according to the new username. (/home/NEWUSERNAME/)
- Change the database names and update them accordingly.
That’s all you need to do to change the username of your DirectAdmin account.