Description
After you select a credential on the Add Host page, the system prompts that "The credential has no sudo permissions."
Possible causes
The host to be added is not initialized.
A common user is used to add the host. You need to configure the common user to gain the sudo permissions without the password.
The sudoer file is incorrectly configured.
Solutions
Check whether the host is initialized.
You need to initialize the host before adding it. For more information, see Initialize a server.
Make sure that you are logged on as the root user when you add a host.
Otherwise, the logged on user must have the permission to run sudo commands without specifying the password. The procedure is described by taking a test user as an example.
Log on to the target host to be added as the root user.
Run the
vi /etc/sudoerscommand to access the sudoers file.Make the following modifications on this file.
Add a row
test ALL=(ALL) NOPASSWD:ALLand add comments Defaults requiretty and Defaults !visiblepw.## Allow root to run any commands anywhere root ALL=(ALL) ALL root ALL=(ALL) NOPASSWD:ALL test ALL=(ALL) NOPASSWD:ALL # Defaults !visiblepw # Defaults requiretty
If you are logged on as the root user, find the sudoers file of the target host in the
/etc/directory and add comments Defaults requireretty and Defaults !visiblepw.
Check for other possible causes.
Run the
ssh 192.168.01.1 'sudo -n true; echo $?'command, where 192.168.0.1 is the IP address of the target host to be added. Enter the password to view the returned information.If the returned information is
sudo: sorry, you must have a tty to tun sudo.Find the sudoers file of the target host in the
/etc/directory and add comments Defaults requireretty and Defaults !visiblepw.If other information is returned, further analysis is required.
If you cannot locate the cause, send the ocp.log file to OCP technical support.