Help Center/ Server Migration Service/ FAQs/ Product Consultation/ How Do I Migrate a Linux Source Server as a Non-root User?
Updated on 2024-08-15 GMT+08:00

How Do I Migrate a Linux Source Server as a Non-root User?

Scenarios

If you must use a non-root user account to perform the migration, ensure that the user has the required permissions.

Procedure

  1. For a hypothetical user, test, check whether the user is included in /etc/passwd. If it is not, run the two commands below to add the user and set a password for it.

    If it is, confirm that user test has a /home directory. If the user does not have a home directory, add one.
    useradd -m test
    passwd test

  2. Modify the /etc/sudoers file to configure permissions.

    1. Add the following information to the end of the /etc/sudoers file based on the OS distribution:
      • Debian and Ubuntu
        test    ALL=(ALL:ALL)    ALL
        test    ALL=(ALL:ALL)   NOPASSWD:ALL
      • Other distributions
        test    ALL=(ALL)    ALL
        test    ALL=(ALL)   NOPASSWD:ALL
    2. If Defaults requiretty is in the /etc/sudoers file, comment it out.

      These modifications to the sudoers file enable the user to execute administrator-level commands without entering a password. After the migration is completed, you need to undo the modifications, or an exception occurs.

  3. Switch to the regular account (test in this example) and run the following command to start the Agent:

    sudo ./startup.sh