Results 1 to 4 of 4

Thread: How to manually (terminal, command line) backup, migrate, restore single user account

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    4

    Default How to manually (terminal, command line) backup, migrate, restore single user account

    How to manually (terminal, command line) backup, migrate, restore single user account?

    Approach below, helps to manage tasks over terminal, which is a much faster way to handle the task.

    Run on source server:

    Code:
    /scripts/pkgacct $user
    mv cpmove-$user.tar.gz /home/$user/public_html
    chmod 644 /home/$user/public_html/cpmove-$user.tar.gz
    Run on destination server:
    Code:
    cd /home
    wget http://$userdomain/cpmove-$user.tar.gz
    /scripts/restorepkg $user
    After successfull migration run on source server

    Code:
    /scripts/killacct $user
    Replace $user with your user account name and $userdomain with user domain name
    Last edited by devbau.com; 04-18-2011 at 07:06 PM. Reason: user to $user

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: How to manually (terminal, command line) backup, migrate, restore single user acc

    I would not suggest placing your backup into public_html where the entire world could then retrieve it even if for a short time period. It is faster and easier to simply scp the backup to the new machine:

    Code:
    /scripts/pkgacct $user
    scp /home/cpmove-$user.tar.gz root@destinationIP:/home/
    You'd replace $user with the cPanel username, destinationIP with the IP number for the new machine. After running the second command, you would be prompted for the password for the destination server.

    Now, if you end up having SSH running on an alternate port on the destination machine rather than port 22, you'd simply add this section:

    Code:
    /scripts/pkgacct $user
    scp -P port# /home/cpmove-$user.tar.gz root@destinationIP:/home/
    Replace port# with the alternate port on the destination machine.

    If you have root user locked down where you cannot SSh as that user, simply scp to a sudo user's home that has shell access:

    Code:
    /scripts/pkgacct $user
    scp -P port# /home/cpmove-$user.tar.gz sudousername@destinationIP:./
    At that point, you'd replace sudousername with the sudo user that has shell access. This would save a copy of the cpmove-$user.tar.gz file to /home/subousername location. You'd then log into the destination machine, sudo su - to root and move the file from /home/sudousername to /home instead:

    Code:
    mv /home/sudousername/cpmove-$user.tar.gz /home
    After you have the account on the destination machine, then you can run "/scripts/restorepkg $user" at that point.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Registered User
    Join Date
    Sep 2009
    Posts
    4

    Default Re: How to manually (terminal, command line) backup, migrate, restore single user acc

    Thank you for great suggestions. Your case is working when ssh with passwords is available. If certs are required, then it's easier to do as i suggested. Og course there is an option to temporarily to make available access without cetts too and to use your suggested method, or share certs.

    When security is a bit mote important, your case is better solution. If even moro higher security is required, then of course shall be considered better methods for file transfers.

    But for avoiding bad habits, its always better to use most secure ways.
    Last edited by devbau.com; 04-18-2011 at 09:29 PM.

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: How to manually (terminal, command line) backup, migrate, restore single user acc

    The commands you provided are SSH commands on both machines, so it would seem both machines have SSH access to get onto them.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads

  1. How to force backup of ONE account from command line
    By Kent Brockman in forum General Discussion
    Replies: 2
    Last Post: 01-16-2014, 01:09 PM
  2. command line backup/restore scripts
    By Goni in forum General Discussion
    Replies: 5
    Last Post: 03-21-2011, 09:51 AM
  3. Replies: 1
    Last Post: 01-29-2010, 09:04 AM
  4. How to manually initiate nightly backup from the command line?
    By cPanelBilly in forum General Discussion
    Replies: 2
    Last Post: 01-10-2008, 12:01 PM
  5. Creating user via command line adds CPanel account!
    By UraniumWeb in forum General Discussion
    Replies: 0
    Last Post: 01-06-2004, 11:15 PM
bargain