How to change the DirectAdmin username

As of April 2021, there is no way of renaming a username from the DirectAdmin GUI. There is a DA script that you can use.

Notice: We recommend taking a backup first. For this go to DA >> Admin Backup/Transfer

How to change a DirectAdmin username:

1. First of all, check if the new username is available with: (you should get an empty response)

# cat /etc/passwd | grep NEWUSERNAME

2. Run the commands:

# cd /usr/local/directadmin/scripts
# ./change_username.sh OLDUSERNAME NEWUSERNAME

3. The username has been changed. You must update now any configurations you have for your site. The path of the account changed. The new path is /home/NEWUSERNAME/.
Also, the database names changed accordingly, so you need to also update them.


In our case, the above commands will be (we want to rename username “plothost” to “plothost2021”):

[root@web /]# cat /etc/passwd | grep plothost2021
[root@web /]# cd /usr/local/directadmin/scripts
[root@web scripts]# ./change_username.sh plothost plothost2021
Killing User processes:
[root@web scripts]#

directadmin change username
DA change username

Running again the cat command will show the new username, so the username has been changed successfully:

[root@web scripts]# cat /etc/passwd | grep plothost21
plothost2021:x:1243:1246::/home/plothost2021:/bin/false
[root@web scripts]#

Leave a Reply