Renaming of admin user

ostendo

Verified User
Joined
Dec 6, 2006
Messages
60
Hi,

I don't really know where to place this topic, so I'll just add it to the general part.. ;)

I just renamed my admin-account to something else using the change_username.sh script in the scripts-directory.
Works pretty great, except:
1. ./data/admin/admin.list still contains "admin" instead of the new username; therefor "List Administrators" fails.
2. httpd fails to start because suspended domains (from other users than admin) still have "/home/admin/suspended" as their DocumentRoot.
3. Cronjobs fail which have "/home/admin/..." in their execution path, but that's maybe something to just give a warning about to the user using the script.
 
Last edited:
I just renamed my admin-account to something else using the change_username.sh script in the scripts-directory.
Works pretty great, except:
1. ./data/admin/admin.list still contains "admin" instead of the new username; therefor "List Administrators" fails.
2. httpd fails to start because suspended domains (from other users than admin) still have "/home/admin/suspended" as their DocumentRoot.
3. Cronjobs fail which have "/home/admin/..." in their execution path, but that's maybe something to just give a warning about to the user using the script.
You need to do more than just running the script: change_username.sh. This tutorial should help:
http://servertune.com/kbase/?View=entry&EntryID=243
 
You need to do more than just running the script: change_username.sh. This tutorial should help:
http://servertune.com/kbase/?View=entry&EntryID=243

Well, I believe this script is meant to be a "complete" script to be all you need to change a username; also if it's admin.
Besides that, I already found that information you give (about changing SSH in particular), but when I look at the script itself, I see the following lines in the script already:
Code:
cat change_username.sh | grep sshd_config -n
85:     #update sshd_config if user exists:
86:     TEMP="/usr/bin/perl -pi -e 's/AllowUsers ${1}\$/AllowUsers ${2}/' /etc/ssh/sshd_config"
So this script already does that. Also, it explicitly checks at some places "to see if we are an admin".

Taking all those things into account, I believed that the script was intended to be a "complete" script to change a username..

And, by the way, if it's not yet such a script, I'd very much appreciate it if it would become one....
 
Hello,

Thanks for the report.

I've addressed #1 and #2 by adding:
Code:
			generic_swap $1 $2 /usr/local/directadmin/data/admin/admin.list
			
			#to be safe, rewrite the whole pile with the updated creator, in case anyone is suspended.
			echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
into the:
Code:
if [ "$TYPE" = "admin" ]; then
part.

#3 would be more up to the creator of the cronjobs.

John
 
Back
Top