Operating System - HP-UX
1829553 Members
2076 Online
109992 Solutions
New Discussion

Re: can sudo users change the root password?

 
praveen..
Super Advisor

can sudo users change the root password?

Hi,
I have added these lines in sudoers files:

User_Alias FULLSUDO = sestj , serab, sebos, seglb, searj, semab, sejos, prkeg

FULLSUDO ALL=(root) NOPASSWD: ALL

please let me know are these users (sestj , serab, sebos, seglb, searj, semab, sejos, prkeg) able to run all the commands including #passwd command (to change the root password)

can they change the root password?

thanks
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: can sudo users change the root password?

Shalom,

They should not be able to change the root password.

Don't take my word for it.

Log in as root

su - seastj

passwd root

If it lets you do it, modify the configuration.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Matti_Kurkela
Honored Contributor

Re: can sudo users change the root password?

Yes they can. You have granted them the permission to assume full root privileges through sudo, so they can do absolutely anything.

There is no technical way on a normal HP-UX to prevent anyone with full root privileges from changing the root password.

Try it out:

# su - sestj
sestj$ sudo -u root /bin/passwd root
or
sestj$ sudo -u root /sbin/passwd root
(changing the root password without prompting for the previous one)

sestj$ sudo -u root vipw
(editing the password file directly)

sestj$ sudo -u root vi /tcb/files/auth/r/root
(editing the Trusted System password file for root, perhaps substituting the password hash with their own, effectively changing the password)

sestj$ sudo -u root -s
(getting a root shell)
MK
Darrel Louis
Honored Contributor

Re: can sudo users change the root password?

Praveen,

When performing the following you'll need to know the old password:
sudo -u root /bin/passwd root
Changing password for root
Old password:

But when they have sudoall rights, they can change the root passwd via "vi".

Darrel
Bill Hassell
Honored Contributor

Re: can sudo users change the root password?

Actually, you configured FULLSUDO users to destroy anything on your system including changing the root password. The entry:

FULLSUDO ALL=(root) NOPASSWD: ALL

The word ALL means that every command in the computer can be run by these users (not a good idea at all!). You should explicitly list the allowed commands on that line, and any command that is not listed will not be allowed. In fact, any FULLSUDO user that tries to run a disallowed command will have their failed attempt logged.


Bill Hassell, sysadmin
Marvin Strong
Honored Contributor

Re: can sudo users change the root password?

Yes you basicly just gave them the keys to the castle. They can do whatever they want.

I would follow Bill's suggestion and specify every command you want them to have access too.

In the case of them needing the majority of the commands you could also take away commands you don't want them to have access too. How to do this is fully documented in the sudo documentation.

Also be careful when allowing commands, allowing any shell or editor, provides a means to get more access than they may normally be allowed. There are alot of commands that you have to be careful of shells and editors are just a quick example.



Rick Garland
Honored Contributor

Re: can sudo users change the root password?

If these users can become root on the system via sudo, they can change the root passwd.

In fact, they will have total access just being a root user.