How to Change Username for your DirectAdmin Account?
The only people with the ability to modify a DirectAdmin account’s username are administrators. But as of April 2021, the username modification feature has been eliminated from the DirectAdmin interface.
We will demonstrate how to accomplish that via SSH access in this article.
Note: Changing the username will prevent access to any of the account’s data. For this reason, before moving on, we advise you to create a complete data backup.
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 /]# cat /etc/passwd | grep newusername
[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:
[root@test scripts]# cat /etc/passwd | grep newusername
newusername:x:1243:1246::/home/newusername/bin/false
[root@test scripts]#
4. Reconfigure the settings for your website.
- Change the path of the Web 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.