Prerequisites for using Linux sudo credentials

  • Provide one of the following:

    • Username and password

    • Username and SSH key file path (in PEM format)

  • Give the sudo users write access to the /var/tmp directory.

  • For sudo users, add the user to the /etc/sudoers file. The following shows the privileges and specifications for users.

    • User: <Sudo_user> (the actual name of the user account)

      Privilege: ALL

      Specification: ALL

  • Edit the entry in the /etc/sudoers file so the system asks for the sudo user password instead of root user password when you run the sudo command.

  • The following shows the privileges to comment or remove from /etc/sudoers.

    • User: ALL

      Privilege: ALL

      Specification: ALL

    NOTE:

    Only use this option with Defaults targetpw on all systems.

  • When using SSH keys for login credentials combined with sudo, edit the entry in the /etc/sudoers file so that the system does not ask for the user password as follows:

    • User: sudo_user

      Privilege: ALL

      Specification: NOPASSWD:ALL