Why can't I use the sudo command with this user?
I am not a system engineer (I am more a software developer). I have the following problem trying to deploy an application on a Linux Centos system.
As the first operation, I need to install Java and perform some preliminary checks installing some tools. During this preliminary phase I performed this command:
sudo yum install redhat-lsb-core
I obtained an error like this one:
USERNAME is not in the sudoers file. This incident will be reported
So I suspect that this user is not a root user or it is not allowed into the /etc/sudoers file. Is it? What can I check to ensure this suspect?
Using this user I also tried to do:
cat /etc/sudoers
and I obtained:
cat: /etc/sudoers: Permission denied
Performing:
grep 'x:0:' /etc/passwd
I obtained:
[email protected] [~]# grep 'x:0:' /etc/passwd
root:x:0:0:root:/root:/bin/bash
So I think that there is only a root user that is not the one that I am using.
So do you think that the only solution is to ask the person handling this server to give me permission to execute sudo
command?
If you are not in the /etc/sudoers
file, then you cannot run commands as sudo
.
That said, if you are a software developer and not in the /etc/sudoers
file, just let the server admin install the packages you need installed.
Your question is really an XY problem; you seem to not need sudo
access as much as you want to install redhat-lsb-core
.
Knowing that, it might be better if you just ask the person who is root
on the server to run:
yum install redhat-lsb-core
As you state clearly in your question:
“I am not a system engineer (I am more a software developer).”
Unless you know what you are doing as far as root
/sudo
access on a server goes and truly need the sudo
access, it might be best you just let that stuff be handled by the people who know how to deal with root
processes on that server.
But as for the specifics of sudo
access, the root
user needs to assign you as a sudoer
in /etc/sudoers
.
Nothing else has to be done. Basic users are not in the /etc/sudoers
by default for obvious reasons: If everyone was placed in the /etc/sudoers
file, then they would all just be the equivalent of root
so what is the benefit?