Change default admin username

ssgill

Verified User
Joined
May 9, 2012
Messages
164
Hello all, i would like to change the default "admin" username. I had done it before using instructions from this KB

http://help.directadmin.com/item.php?id=193

but it created lot of problems, apache won't start and few other that i dont remember cause i had to change it back to admin. But for PCI DSS compliance i have to change it. I found these instructions from ServerTunes.com . Posted below
HowTo :: change DA default username "admin"

The default username to access DirectAdmin control panel is admin. If you wish to change the username admin to something else, SSH to the server and do the following:

cd /usr/local/directadmin/scripts
./change_username.sh admin NEW_USER
Replace NEW_USER with the username you want.

Using your favorite Linux editor such as pico or vi, edit the server’s shell configuration file:

vi /etc/ssh/sshd_config

Find the directive:
AllowUsers admin

Change it to:
AllowUsers NEW_USER

Save and exit. Restart the SSH service:

/sbin/service sshd restart

Edit the DirectAdmin list of allowed admins file:

vi /usr/local/directadmin/data/admin/admin.list

Change the directive with the admin username to the NEW_USER for the admin account. Save the file and exit.

We strongly suggest you run another SSH windows to make sure you can login successfully using the NEW_USER before closing your current/active SSH session.

Can some one please verify if above instructions or correct and complete or there are instructions from DA that i have failed to locate. Please this is main admin account for DA login. Thanks
 
Off topic but the best way to pass PCI is to block DirectAdmin altogether except from the ip's from where you would be logging in.
 
Thanks floyd for the tip, but they still want me to change default username. Its like you cannot use any vendor supplied usernames. Thanks
 
Can some one please verify if above instructions or correct and complete or there are instructions from DA that i have failed to locate. Please this is main admin account for DA login. Thanks

Though I did not follow the guide by myself, it seems to me to be a correct one. Just try it out and update us with your results.
 
Hello,

I checked the code in the script, and found this:
Code:
        #update sshd_config if user exists:
        TEMP="/usr/bin/perl -pi -e 's/AllowUsers ${1}\$/AllowUsers ${2}/' /etc/ssh/sshd_config"
        eval $TEMP;
so I'm not sure if it's just not working in your case? Not too sure.
I ran a test on an old Fedora box, and it seemed to work ok.

John
 
I'm writing to follow-up on this as I have the same need. Is the above all that was necessary or is there more. The last thing I want to do is lock myself out of the boxes. Thanks.
 
Well, I tried it and then I run /usr/local/directadmin/custombuild/build rewrite_confs
Afterwards I restarted Apache, MySQL, Exim, Dovecot & DirectAdmin just in case.

if you already have any suspended domains, Apache will complain (Warning: DocumentRoot [/home/admin/domains/suspended] does not exist) when you try to restart it.
Just find those domains, unsuspend and suspend them again.
Also, open the file /usr/local/directadmin/data/admin/backup.conf and replace the line "local_path=/home/admin/admin_backups" with "local_path=/home/newuser/admin_backups" (substitute newuser with your new username)
 
Back
Top