Add a sudo user on an Ubuntu system
Privilege Secure for Discovery needs an account with sudo permissions to register a Linux system. This procedure creates that account on an Ubuntu system. Repeat it on each endpoint, or create the account through your configuration management tool. For the other requirements, see Linux registration prerequisites.
Create the account
-
Connect to the system over SSH as a user that can run
sudo. -
Add the user. This procedure uses
svc-netwrix. Replace it with your account name:sudo adduser svc-netwrix -
Enter and confirm a password when prompted.
-
Press Enter at each prompt for user information, or fill in the fields.
-
Enter
yto confirm. -
Add the user to the
sudogroup:sudo usermod -aG sudo svc-netwrix -
Switch to the user and test
sudo:sudo su - svc-netwrixsudo whoamiEnter the password when prompted. The command prints
root.
Use this account name and password when you register the system.
Run sudo without a password
Password authentication doesn't need this step. Complete it if the account signs in with an SSH key, because the product then has no password to send to sudo. You can also use it to meet a policy that requires passwordless sudo for service accounts.
-
Open a new sudoers file for the account. The
visudocommand checks the syntax when you save:sudo visudo -f /etc/sudoers.d/svc-netwrix -
Add this line:
svc-netwrix ALL=(ALL) NOPASSWD:ALL -
Save the file and exit the editor. In the default editor, press Ctrl+X, press Y, and press Enter.
-
Test that
sudono longer asks for a password:sudo su - svc-netwrixsudo -n whoamiThe command prints
root. If it printssudo: a password is required, check the file name and the line.
After the first scan, the product rewrites /etc/sudoers and moves the rules from /etc/sudoers.d into it. The account keeps its sudo access.