Rename admin account

eSupport.org.ua

Verified User
Joined
Oct 4, 2004
Messages
62
Location
UA
I want consolidate few servers to one.
Unforthunatly, they have a lot of sites to admins accounts.

I want rename admin account to admin1, admin2, etc.

Please help me correct rename admin account.
 
Create another admin user then login as that user and then delete the admin user.
 
Hello,

You might want to try this /usr/local/directadmin/scripts/change_username.sh

Code:
# /usr/local/directadmin/scripts/change_username.sh
DirectAdmin username changing script (Beta)

Usage: /usr/local/directadmin/scripts/change_username.sh oldusername newusername


Otherwise, you might want to rename backups before transferring them to you r new server, e.g.:

admin.root.admin.tar.gz => admin.root.admin1.tar.gz
user.admin.u10001.tar.gz => user.admin1.u10001.tar.gz
...
...
...
user.admin.u11111.tar.gz => user.admin1.u11111.tar.gz

and restore them on a new server after you restore a new admin1.
 
You should change the Admin password, I think admin permission couldn't change.

may be the bellow text will be helpful:

Setup Secure Shell (SSH) Service

1. Add the admin user to the wheel group:

# usermod -G wheel admin
2. Edit the server’s SSH configuration file:

# nano -w /etc/ssh/sshd_config
3. To allow only SSH protocol 2 connections, find the line:

#Protocol 2, 1
4. Uncomment it and change it to:

Protocol 2
5. Next, to disable direct root login, find the line:

#PermitRootLogin yes
6. Uncomment it and change it to:

PermitRootLogin no
7. Next, to change the port that SSH listens on, find the line:

#Port 22
8. Uncomment it and change it to:

Port 1022
9. Save the file and exit the editor.
10. Restart the SSH service:

# service sshd restart

Change the Server Admin Username

1. Change the admin username:

# cd /usr/local/directadmin/scripts
# ./change_username.sh admin newuser

Note: Replace ‘newuser’ with the username you wish to use for the admin account.
2. Edit the server’s SSH configuration file:

# nano -w /etc/ssh/sshd_config
3. Find the line:

AllowUsers admin
4. Change it to:

AllowUsers newuser
5. Save the file and exit the editor.
6. Restart the SSH service:

# service sshd restart
7. Edit the DirectAdmin list of allowed admins file:

# nano -w /usr/local/directadmin/data/admin/admin.list
8. Change the line with the admin username to the new username for the admin account.
9. Save the file and exit the editor.
 
The admin user has no rights in ssh. If you dont want them to be able to login you might have trouble with that. Any admin user can just enable ssh access again via directadmin.
 
You don't understand me.
Direct Admin not provide interface for revoke admin privilegies. I want do it use ssh.
Also I found bug in rename script:
Warning: preg_replace(): No ending delimiter '_' found in /usr/local/directadmin/scripts/change_database_username.php on line 84

Warning: preg_replace(): No ending delimiter '_' found in /usr/local/directadmin/scripts/change_database_username.php on line 78

Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /usr/local/directadmin/scripts/change_database_username.php on line 81

Warning: preg_replace(): No ending delimiter '_' found in /usr/local/directadmin/scripts/change_database_username.php on line 84

Warning: preg_replace(): No ending delimiter '_' found in /usr/local/directadmin/scripts/change_database_username.php on line 78

Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /usr/local/directadmin/scripts/change_database_username.php on line 81

Warning: preg_replace(): No ending delimiter '_' found in /usr/local/directadmin/scripts/change_database_username.php on line 84

Warning: preg_replace(): No ending delimiter '_' found in /usr/local/directadmin/scripts/change_database_username.php on line 78

Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /usr/local/directadmin/scripts/change_database_username.php on line 81

Warning: preg_replace(): No ending delimiter '_' found in /usr/local/directadmin/scripts/change_database_username.php on line 84

Warning: preg_replace(): No ending delimiter '_' found in /usr/local/directadmin/scripts/change_database_username.php on line 78

Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /usr/local/directadmin/scripts/change_database_username.php on line 81

I lost all mysql users and restore it in mysql dump mysql table. May be this script is old. Where I can download fresh version?
 
You don't understand me.
Direct Admin not provide interface for revoke admin privilegies. I want do it use ssh.
َI think you couldn't do that on SSH too,

your only way is to find "user.conf" file on "/usr/local/directadmin/data/users/admin/user.conf" and account=ON to account=OFF. And important point if you off this you can't do any thing by this user even login . Do you understand that risk?
 
But I can create account admin1, and remove /usr/local/directadmin/data/users/admin, copy admin1 and change admin1 to admin. Afrer I can merge domains, httpd.conf, etc. Exclude admin config files.
 
Not, sure what you are trying to do with admin accounts? Do you need them on your new server? If they host domains, you might want to create a new user and move all domains to that new user.
 
I don't want movie domains to new user - too much work.
Actually now I knew how to rename admin account and revoke admin grants. It not hard work in ssh :)
 
Hello,

In case the answer was missed, you can revoke Admin rights turning the account into a Reseller by simply editing the user.conf, change:
Code:
usertype=admin
to be
Code:
usertype=reseller
Then edit these 2 files and move the name from admin.list to reseller.list:
/usr/local/directadmin/data/admin/admin.list
/usr/local/directadmin/data/admin/reseller.list

John
 
Back
Top