Support Questions

Find answers, ask questions, and share your expertise

run install by root, but always get error : "root is not in the sudoers file. This incident will be reported." why installer try to 'sudo'?

avatar
Expert Contributor

I checked all files requiered FQDN in /etc/sysconfig/network, /etc/hosts.., and add root ALL=(ALL) NOPASSWD: ALL at end of sudoers file. why it always complain about root is not in sudoers file? and error only occurs when you do 'sudo' as root user.

is it possible a bug in installer?

1 ACCEPTED SOLUTION

avatar
Guru

can you please print output of /etc/sudoers file ?

If you have added your user to sudousr file then the cleanest way of doing things is probably to grant the root group to your user. For instance,

to add user oracle to the admin group:

usermod -aG root root

View solution in original post

10 REPLIES 10

avatar
Master Mentor

@Robin Dong

Your account does not have permission to sudo

What's the output of command id?

id

avatar
Master Mentor
@Neeraj Sabharwal

I don't think root user need to be included in the sudoer file! By default root can su and become any user ,so how does one explain that?


root-sudoers.jpg

avatar
Master Mentor

@Geoffrey Shelton Okot There was issue with the root user as it had no gid and uid. usermod did help to fix the issue.

avatar
Master Mentor

The root user is the first default user installed on any Linux box install,which automatically creates the group and user assigning root the UID 0 and GID 0 this is a very bizzare case !

Does-the-root-account-always-have-uid-gid-0

avatar
Master Mentor

@Geoffrey Shelton Okot Human error caused this issue. 🙂

avatar
Expert Contributor

I start installer, then at intall options, SSH User Account --> root

the next page, confirm hosts, I got this in log every time:

==========================
Creating target directory...
==========================

Command start time 2016-02-04 20:59:43
root is not in the sudoers file.  This incident will be reported.
root is not in the sudoers file.  This incident will be reported.
root is not in the sudoers file.  This incident will be reported.
root is not in the sudoers file.  This incident will be reported.
root is not in the sudoers file.  This incident will be reported.

Connection to avechdmq1.ae.ge.com closed.
SSH command execution finished
host=avechdmq1.ae.ge.com, exitcode=1
Command end time 2016-02-04 20:59:43

ERROR: Bootstrap of host avechdmq1.ae.ge.com fails because previous action finished with non-zero exit code (1)
ERROR MESSAGE: tcgetattr: Invalid argument
Connection to avechdmq1.ae.ge.com closed.

STDOUT: root is not in the sudoers file.  This incident will be reported.
root is not in the sudoers file.  This incident will be reported.
root is not in the sudoers file.  This incident will be reported.
root is not in the sudoers file.  This incident will be reported.
root is not in the sudoers file.  This incident will be reported.

Connection to avechdmq1.ae.ge.com closed.

avatar
Master Mentor

[root@hostx .ssh]# ls

authorized_keys id_rsa id_rsa.pub known_hosts

The first one contains the private key, the second one contains the public key for user root.

Now run the command

cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys

it will add the contents of the root’s file id_rsa.pub to a file authorized_keys.

Therefore, if a user will connect to this machine by SSH and will specify the correct private key, this machine will look up into authorized_keys and will know that this is root.

remember to copy the authorized_keys to all the servers in the cluster

Also check the permissions on the .ssh directory, id.rsa,authorized_keys and id_rsa.pub keys


keys-permissions.jpgssh-permissions.jpg

avatar
Guru

can you please print output of /etc/sudoers file ?

If you have added your user to sudousr file then the cleanest way of doing things is probably to grant the root group to your user. For instance,

to add user oracle to the admin group:

usermod -aG root root

avatar
Master Mentor

@Robin Dong This is the best answer as per my opinion.