Move User Between Resellers

Mindlash

Verified User
Joined
Jul 22, 2003
Messages
36
I saw a previous post by Two-A-T (hi c-man) about manually editing files move users... though I have a feeling it may be a bit incomplete?

Have there been any updates since then that would need attention.

I currently need to move 5 users from one reseller to another reseller account.

Any suggestions?

The file user.conf once edited didn't seem to make any differences once the 'new' reseller logged in and checked their users.

... Thanks.
 
I think you have to edit the reseller's user list in addition to each users' user.conf file.

One thing on the top of my list right now is the option to convert a user to a reseller and vicaversa. It's a pain in the arse right now.
 
Awsome... that worked:

Files Edited
[user file]
/usr/local/directadmin/data/users/[username]/user.conf
-- change line:
creator=older_resller_name
to
creator=new_resller_name

[reseller list]
usr/local/directadmin/data/users/[reseller_username]/users.list
-- copy all files from
usr/local/directadmin/data/users/[old_reseller_username]/users.list
to
usr/local/directadmin/data/users/[reseller_username]/users.list

Log into DA as the new reseller and boom... all there.

NOW, question is.... How simple is it to not only move a current reseller to a normal user account under a reseller... but also to rename that account

Example Current Tree:
-+Reseller_A
--user1
--user2
-Reseller_B

Needs to be
-+Reseller_B
--user1
--user2
--user3 (old Reseller_A)

I've already gotten the old users moved over to the new reseller... just got to move the old reseller (A) to under the new reseller (B) and rename the old reseller :)

Thanks again for your quick response and help l0rdphi1
 
It's simply a matter of tinkering with the right files :D

Um..well actually... what I would first do is backup and remove the old resellers DA configuration files. Next I'd copy an existing users' directory overtop the old reseller's directory. Then it is a matter of modifying the user's files you copied to match the old reseller's data which you backed up.

I don't think I made much sense there. Good luck. =|
 
HowTo....

Tinkering is what I did... I always like posting findings so here's what I did... files I edited... etc in case other have this need.

1) backup these files before doing what I've done, just in case

2) continue... :)

[Renaming User] (in my case a reseller)
usermod -d /home/newname oldname
#sets new home directory. File affected: /etc/passwd

usermod -g newname oldname
#sets intial group.

groupmod -n newname oldname
#changes the group name. File(s) affected: /etc/group & /etc/gshadow

cat /etc/passwd |grep newname
#this verifies the home directory was set properly (displays)

[Move old home directory to new directory]
mv /home/oldname /home/newname

[Change Apache to point to new home location]
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue

replace /home/oldname/ /home/newname/ -- /etc/httpd/conf/httpd.conf
#This replaces the individual path for Apache to load the new location's individual httpd.conf settings

replace oldname newname -- /etc/httpd/conf/ips.conf
#makes sure to replace the normally 'auto-generated' file here, otherwise apache will give errors

/etc/rc.d/init.d/httpd restart
# restart appache to take affect
# Also note, if you don't use that script, you'll probably get SSLEngine errors when restarting apache.

[Change FTPD info]
replace oldename: newname: -- /etc/proftpd.passwd
#Notice the colon's at the end of the names, keep those but change the names as needed

#NOTE:
#if by chance the UID in /etc/proftpd/passwd is 9999:9999: you will need to put in the original UID, found simply by typing:
#ls -n /home/
#... this should return a number (probably a 500'ish number) replace both sets of 9999 with that number.

service proftpd restart
#restart proftpd

---- someone with a bit more skill than I could easily write a script to take care of all these changes simply prompting the user for two vars.. 1) old name to change, 2) new name to be...

*wink?*


Far as I know these should do the trick. If anyone else can think of any other changes that need to be done, lemmie know. :)
 
Last edited:
Oh. For some reason I thought you wanted to convert a reseller to a user.

Oh well :)
 
Yes, I did need that to... which I did but forgot to post. :-/

Just edit the user.conf file and change the type from reseller to user

...

:) .. the rest are also instructions on how to rename the reseller account if needed.

:)
 
Yeah, but I remember there being conf files for resellers that aren't needed for normal users. I'm sure they don't hurt though.
 
You're right.. they don't...

I removed them but forgot to note which ones they were! I just compared to another user account.. hehe woops.
 
Yeah that's what my post was getting at. Anyway nice to see you got it all working :}

Maybe I'll throw a script together tonight. :)
 
Well I'd like such a feature as well, that you can change the users properties such as:

* ownership of the user (move a user between resellers)
* Level of the user (upgrade / downgrade a user / reseller)
* Name of the user (rename a user / change his primary domain)

So if this can be put on the features wish list that'd be great ;)
 
My list goes

1. IMAP
2. Level of the user (upgrade / downgrade a user / reseller)
3. Server-to-Server user / reseller transfer
4. Ownership of the user (move a user between resellers)
5. Name of the user (rename a user / change his primary domain)

:D

If I could find out what at least the priority of each these things are I'd know which to throw scripts together for and which not to. *cough* ;)
 
Automated ownership change

Are there any scripts to change user's ownership directly from DirecAdmin? We often need to move users from one reseller to another, so built-in function in the DirectAdmin admin area would be very usefull.
I saw similar paid script in this forum some time ago but now I did not manage to find it.
 
The script is done :) Maybe it will be included into the future releases of DirectAdmin. For now just use:
Code:
cd /usr/local/directadmin/scripts
wget http://www.servermonkeys.com/projects/els/directadmin/move_user_to_reseller.sh
chmod 700 move_user_to_reseller.sh
chown diradmin:diradmin move_user_to_reseller.sh
Usage:
Code:
cd /usr/local/directadmin/scripts
./move_user_to_reseller.sh <user> <oldreseller> <newreseller>
Good luck!
 
Last edited:
The script is done :) Maybe it will be included into the future releases of DirectAdmin. For now just use:
Code:
cd /usr/local/directadmin/scripts
wget http://www.servermonkeys.com/projects/els/directadmin/move_user.sh
chmod 700 move_user.sh
chown diradmin:diradmin move_user.sh

Usage:
Code:
cd /usr/local/directadmin/scripts
./move_user.sh <user> <oldreseller> <newreseller>

Good luck!
may i know how to do this? where to insert the code?
 
Everything is written in "Usage" :) E.g. if you need to transfer user user1 to reseller reseller2 from reseller reseller1. You need to write: ./move_user_to_reseller.sh user1 reseller1 reseller2
 
Last edited:
Bug in move_user_to_reseller.sh?

echo "Changing user owner"
for i in `ls /usr/local/directadmin/data/users/$1/domains/*.conf`; do { perl -pi -e "s/creator=$2/creator=$3/g" $i; }; done;

But "creator=" line is user.conf, one dir up from "domains", so it never gets updated to a new creator.

Changing the line to:

for i in `find /usr/local/directadmin/data/users/$1/ -name '*.conf'`; do { perl -pi -e "s/creator=$2/creator=$3/g" $i; }; done;

would search through all conf files in user's dir. If creator is always written only in user.conf file, no searching is even necessary, but not sure about this one.
 
ok i created several domains under the user tab of the master admin account. now i want to move the domains under the reseller tab of the master admin account so each domain will have its own username and password. This was i can have different people managing different domains. i have checked the move user from reseller to user and vise versa but this does not work. as the domains were not setup as a reseller or a user but more under a user account. Does anyone know how i can move these into thier own accounts?
 
Back
Top