Configure sudo in Debian

By default, root account is not enabled to log into Debian. As a result, a sudo authentication is needed when you add Debian Linux as a Linux Node.

Follow these steps:

  1. Log in to the Linux node and switch to root using su command.
  2. If sudo is not installed, install sudo package using the following command:
  3. apt-get install sudo

  4. Add an existing user with id=user to group=sudo:

    Example:

    adduser user sudo

  5. or create a new user with sudo
  6. adduser user

    adduser user sudo

  7. Log into the user shell, and type the following command to verify that the user is authorized:
  8. sudo -v

You have successfully configured sudo in Debian.

Note: For Debian 12.x, after performing the above steps, open the /etc/sudoers file from root, comment the following line in the sudoers file, and then save the sudoers file:

Defaults use_pty