How Do I Migrate a Linux Source Server as a Non-root User?
Scenarios
If you must use a non-root user to perform migration, ensure that the user has the required permissions before creating a migration task.
Procedure
- For a hypothetical user, test, check whether the user is included in /etc/passwd. If it is not, run the following two commands to add the user and set the password: If it is, confirm that user test has a /home directory. If the user does not has a home directory, add one.
useradd -m test passwd test
- Modify the /etc/sudoers file.
- Add the following information to the end of the /etc/sudoers file based on the OS version:
- 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
- Debian and Ubuntu
- If Defaults requiretty is in the /etc/sudoers file, comment out it.
These modifications to the sudoers file grant the user the ability to execute administrator level command without entering a password. After the migration is completed, you need to remove the added lines, or an exception occurs.
- Add the following information to the end of the /etc/sudoers file based on the OS version:
- After the permissions are configured, switch to a regular account and run the following command to start the Agent:
sudo ./startup.sh
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.