sudo - Not working

NeXT Computer, Inc. -> NEXTSTEP / OPENSTEP Software

Title: sudo - Not working
Post by: armus2112 on November 12, 2014, 05:40:17 PM
Hi, I just installed 'sudo-1.6.7p5.pkg.NIHS.tgz' in Openstep 4.2. I used /usr/local/sbin/visudo to setup the /etc/sudoers file which looks like this:

root ALL = (ALL) ALL
gf ALL = (ALL) ALL

When I attempt 'sudo' from gf user, when I type the password, nothing happens. It's not even moving the cursor as I type the password. ENTER key does nothing. The cursor is just stuck there right next to "Password:". Have to Ctrl-C out of it. It seems to be hanging. Any suggestions are welcome, thank you!!!


Quote
[gf@flight /Users/gf]$ sudo whoami

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these two things:

       #1) Respect the privacy of others.
       #2) Think before you type.

Password:
Title: Re: sudo - Not working
Post by: Ostrich on February 14, 2023, 02:32:22 PM
Same problem. Anyone gotten sudo working?
Title: Re: sudo - Not working
Post by: verdraith on February 14, 2023, 05:39:40 PM
At first glance, looks like it's not setting the right flags when setting up raw terminal input.

Does anyone know where the source for that package is?


--edit--
You should be able to set up /etc/sudoers or whatnot so that you don't have to provide a password.  I don't recommend you do that, however.
Title: Re: sudo - Not working
Post by: bkmoore on February 14, 2023, 09:16:35 PM
I got sudo working, but with the password disabled. I'm using sudo 1.6.7 patch 5 from kb7sqi's packages. According to the INSTALL file from the original source code:

Mac OS X:
    It has been reported that for sudo to work on Mac OS X it must
    either be built with the --with-password-timeout=0 option or the
    password timeout must be disabled in the Defaults line in the
    sudoers file.  If sudo just hangs when you try to enter a password,
    you need to disable the password timeout (Note: this is not a bug
    in sudo).

I don't know if this is the reason the terminal becomes unresponsive when sudo asks for a password, but it seems plausible. I attempted to recompile sudo using the --with-password-timeout=0 flag, but compile was unsuccessful. I'm not sure which gcc version kb7sqi used for the original compilation.

Disabling password for me in the /etc/sudoers file fixed sudo and I was able to use it. Below is my /etc/sudoers file for reference. To reenable password for me, just delete the last line from the file. From a security standpoint, don't do this...

User_Alias     FULLTIMERS = me

Defaults               env_reset
Defaults               mail_badpass
Defaults:FULLTIMERS    !lecture, passwd_timeout=0

root     ALL = (ALL) ALL
%wheel   ALL = (ALL) ALL
%sudo    ALL = (ALL) ALL
FULLTIMERS     ALL = NOPASSWD: ALL

Brian
Title: Re: sudo - Not working
Post by: bkmoore on February 14, 2023, 09:27:26 PM
Quote from: verdraith on February 14, 2023, 05:39:40 PMDoes anyone know where the source for that package is?

Source Code found here: https://www.sudo.ws/dist/OLD/ (https://www.sudo.ws/dist/OLD/)
Title: Re: sudo - Not working
Post by: verdraith on February 14, 2023, 11:06:17 PM
I grabbed 1.6.7 from GitHub, stared at it with the steely eyes of a Unix wizard, and it compiled itself quad-fat.

https://www.dropbox.com/s/aum4idatg1oeesx/sudo-1.6.7.NIHS.b.tar.gz?dl=0 (https://www.dropbox.com/s/aum4idatg1oeesx/sudo-1.6.7.NIHS.b.tar.gz?dl=0)

Would you mind testing it to destruction?

If it works, I'll put together a proper release for it in my `UnixKit` repo.  I might try compiling later versions to see if those work, too.
Title: Re: sudo - Not working
Post by: verdraith on February 14, 2023, 11:37:44 PM
Actually, this isn't 1.6.7 patch 5... and for some reason, that patch isn't tagged in the repo.  Ugh, the joys of ancient software -- my build is probably vulnerable to something or other, then.

I'll try experimenting with a later build.
Title: Re: sudo - Not working
Post by: bkmoore on February 14, 2023, 11:56:46 PM
Quote from: verdraith on February 14, 2023, 11:06:17 PM...Would you mind testing it to destruction?...

With the steely eyes of a hobbyist-UNIX hacker, I tested your build on my OpenSTEP 4.2 installation. It worked with both password disabled and then with password enabled.
Title: Re: sudo - Not working
Post by: verdraith on February 15, 2023, 12:17:45 AM
Ok, here's a version with patch 5 applied.

https://www.dropbox.com/s/rk83kx0o54ydb19/sudo-1.6.7p5.NIHS.b.tar.gz?dl=0 (https://www.dropbox.com/s/rk83kx0o54ydb19/sudo-1.6.7p5.NIHS.b.tar.gz?dl=0)

Seems most versions after that refuse to compile due to gnarly pointer arithmetic that probably wants a newer GCC.

This build is compiled with plain GCC 2.5.8 (the version that ships with NS 3.3)

--edit--
And now I'm tempted to add NetInfo support... :D

Actually, no, I'm really tempted to add NetInfo support... I'll add it to the todo list.  Would need me to design a NI directory structure for it.
Title: Re: sudo - Not working
Post by: bkmoore on February 15, 2023, 11:17:26 AM
I tested your compilation of sudo-1.6.7p5 on both my OpenStep 4.2 and NextStep 3.3 installs under Previous. Both work as they should. I cleaned up my /etc/sudoers file since it is no longer necessary to disable password authentication, or set the passwd_timeout=0 flag.

#
# /etc/sudoers
#
User_Alias     FULLTIMERS = me

Defaults               env_reset
Defaults               mail_badpass
Defaults:FULLTIMERS    !lecture

root     ALL = (ALL) ALL
%sudo    ALL = (ALL) ALL
Title: Re: sudo - Not working
Post by: verdraith on February 15, 2023, 01:13:49 PM
compilers have compiled, editors have edited, steely eyes have glared, packages have been packaged, and the sleeping dragon has been thoroughly poked.

https://github.com/Asmodai/NeXT-UnixKit/releases/tag/v1.0 (https://github.com/Asmodai/NeXT-UnixKit/releases/tag/v1.0)

As a bonus, I've compiled vim ('normal') quad-fat.  It also has support for the Motif library provided with Cub'X-Window.

p.s. if anyone knows how to dispose of used Unix wizard eyes safely without having to jump through all kinds of COSHH paperwork, please let me know.
Title: Re: sudo - Not working
Post by: Ostrich on February 15, 2023, 10:03:35 PM
Holy cow, I didn't expect bumping this 8+ year old thread would turn into this. Y'all are amazing.
Title: Re: sudo - Not working
Post by: trixster on August 19, 2024, 11:21:30 AM
Hi all,

I'm struggling to get sudo to work. it runs fine if im logged in as root, but if i'm logged in as user 'andy' sudo returns "Sorry, sudo must be setuid root". However sudo is owned by root, and is in group wheel! sudo's permissions are 0755

My sudoers file in /etc is as follows:

#
# /etc/sudoers
#
User_Alias     FULLTIMERS = andy, root

Defaults               env_reset
Defaults               mail_badpass
Defaults:FULLTIMERS    !lecture

root     ALL = (ALL) ALL
%sudo    ALL = (ALL) ALL
FULLTIMERS     ALL = NOPASSWD: ALL

any ideas what might be amiss? user 'andy' is a member of other, sys and wheel.
Title: Re: sudo - Not working
Post by: stepleton on August 19, 2024, 12:00:10 PM
Root ownership and 755 permissions are not enough. You need to set the setuid bit as well: https://en.wikipedia.org/wiki/Setuid . That's what the error message about "setuid root" is about.
Title: Re: sudo - Not working
Post by: stepleton on August 19, 2024, 12:01:39 PM
To be clear: as root, chmod u+s /path/to/sudo
Title: Re: sudo - Not working
Post by: trixster on August 19, 2024, 12:32:10 PM
Thanks! Worked a treat :) I had tried with +s (I think) as i'd googled setuid previously, but that had returned an error. It's tough to work out what to do when you've only got a passing knowledge of raspberry pi Linux  ;D 

Go to top  Forum index