Showing results for 
Search instead for 
Did you mean: 

Transferring accounts


Transferring accounts

I'm sure that someone has done this, so here goes:

    1. Parent's account is eaglecentre.
    2. My nice shiny, new account (2 megabits of pure speed) now hosts my domain name ( and I want to move my web sites over.
    3. I want to move all my cgi scripts and all my databases over to my takealeft with minimal fuss.
    4. The issues are as follow:

      I have to copy the database. Do I just get a db dump, and then do a find and replace for eaglecentre with takealeft, and then insert the stuff back on the server with the new username? Is there an easy way of inserting all the stuff back onto the database?
      can I do this equally well with all the actual files.... just chmod my directory and then do a copy? And then replace all the links to eaglecentre with takealeft? But what about permissions for all of my files. Some require specific permissions, and there are a few files here and there Wink

    Are there any other issuesHuh Anyone have a script?

    5. Would I be better getting my to forward to the cgi.eaglecentre..... and then ignoring these issues?? Is this even possible? Anyone from f9 care to comment?

TIA everyone.

Transferring accounts

I think the points you've made are pretty much on the ball.

If you're on good terms with your parents, and they're not making use themselves of the web / database / cgi facilities of their account, this could be to your advantage, for, as long as they retain their account, it could effectively double the extent of your "online empire". Since you know the passwords you can exercise full control over the facilities from your own Force9 connection.

So you could simply leave everything where it is and access it from web pages on your own account.

If you do want it all on your own account, then, effectively, you're doing a fallback and recovery exercise. (In fact, as you've pointed out it's a bit more complicated than that because account names, domain names, database names and passwords will have to be changed to reflect the new account). From this point of view, it wouldn't be a bad exercise to undertake, because it would be a means of seeing if you could recover your site in the event of a disaster -- the kind of exercise that businesses conduct from time to time as part of their own disaster planning.

The database export facillity allows you to create a backup of your existing database. If you backup as a series of SQL statements, you can simply read this back in on the new database to recreate your tables and data. Depending on how much data you have, you may have to do this in segments rather than one huge backup file.

Regarding your files on the CGI server, you could just log on as takealeft and (depending on permissions set) copy the files from the eaglecentre account to your own account. The problem there would be that on the eaglecentre side your takealeft account would access the files by virtue of being a member of group "shellcgi" (or whatever it is), whereas on your own account you would access the files as the owner/user. In view of this, I think it would probably be easier to log on as "eaglecentre" (which you can do from your "takealeft" connection, because you know the password for the eaglecentre account), and create a "tar" archive of all the directories/files you're interested in, make sure "shellcgi" group can read that file, then log on as takealeft, copy the tar file to your own space and decompress it.

You can preserve permissions by doing things this way. (In any case, it's only permissions for "other" which have doubt about them -- you're the "owner/user", so you can safely give yourself whatever permissions you like; the group access permissions should be nothing whatsoever, to stop other shell users from seeing/accessing your stuff, so that's pretty much a "no-brainer" [although if you want to access both "eaglecentre" and "takealeft" data from one session, that's no longer true].)

As you say having got your files across to your account, you would then need a script to recurse through the directory structure editing the files so that any instances of old account names, database / web / cgi server names, database names, hostnames and passwords are changed to the new ones.

Here's a rather crude (and untested!) script which could be used to go through all the files in a single directory, making the kind of changes you want. It uses the "ex" line editor to edit the file:

    for filename in "$@"
    echo ${filename}
    /bin/ex - ${filename} << end-of-edits
The lines starting %s are the ones which do the edits (% tells ex to look from the first to the last line of the file, the s tells ex you want to substitute some text for different text), the text between / and / tells ex which text to find and what to put in its place, the g at the end of the line tells ex to replace all occurences on that line (ie global). Note the dots in the hostnames are escaped with a backslash in the "find" part of the substitution. The line "wq" tells ex to write the changes back to the file and to quit. You can add extra substitutions if you need them before the wq line(!), and you should replace the database hostnames and password values as appropriate (don't leave the file lying around with the passwords visible, though!).

If you create the file as (say) editscript, and make it executable by you (chmod 700 editscript), you could then invoke it with
    ./editscript <directory-to-process>/*
which would edit all the files in the <directory-to-process> directory. Getting the script to recurse through a complete directory tree is more complicated, and I'll leave that to you!!!

And then the testing phase! If you've goofed, no matter -- the data still exist on the eaglecentre account, so you can always go back and start from scratch.

Transferring accounts

AH, thank you very much! Tarring does of course solve the permission issue. I shall give this a try (perhaps next weekend now) and see how it goes, thanks!
Your script's pretty neat too - cheers! Cheesy