HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

is SUDO 100% root?

 
John Guster
Trusted Contributor

is SUDO 100% root?

Here is the example: nickel script downloaded tar file. login as root to untar it with no problem, but sudo to root can't untar it. what is behind this, environment variable? or is sudo 100% of root?
5 REPLIES
Michael Steele_2
Honored Contributor

Re: is SUDO 100% root?

Hi

Need

name of account executing the sudo command
the command
the /etc/sudoers file
Support Fatherhood - Stop Family Law
Bill Hassell
Honored Contributor

Re: is SUDO 100% root?

> sudo to root can't untar it

Hummmm, was there some sort of error message like parity error on disk, or did tar core dump, or out of memory? Maybe a permission problem or possibly a sudo error message such as the wrong permission on config files and directories?

sudo works exactly as defined by the sudoers file. A bit more information will help.


Bill Hassell, sysadmin
Matti_Kurkela
Honored Contributor

Re: is SUDO 100% root?

By default, sudo makes a 100% change to the user identity of the session, but a minimal change to the environment.

If you run "sudo -s" to get a root shell, you'll get the shell specified in your regular $SHELL environment variable, using the shell startup scripts in your regular $HOME.

This is so that if you prefer a plain "# " root prompt and another sysadmin at your site wants a 160-character colourful prompt with username + hostname + load level + pathname + a blinking clock, you both can easily get what you want without interfering with each other's setups.

If you want to get /sbin and /usr/sbin included to your PATH when using sudo, you have to either use "sudo -i" (or "sudo -H -s" with older versions of sudo) or make your regular session startup scripts detect when the shell is running them as root and make the necessary changes.

MK
MK
John Guster
Trusted Contributor

Re: is SUDO 100% root?

the permission is "ALL" since this login account is for the system administrator. We had security patch installed, then some script has to be run as root, not through the root from sudo. The error message is "you have to be root to run", and whoami tells it is root.
James R. Ferguson
Acclaimed Contributor

Re: is SUDO 100% root?

Hi John:

> The error message is "you have to be root to run", and whoami tells it is root.

There is a big difference between what 'whoami' and 'who am i' return.

The first form ('whoami') returns the effective user name. The second form ('who am i') returns the original, initial login name.

Regards!

...JRF...