Is there a way to turn off "Switching to root credentials"?

Hi guys,

I discovered, by accident, that the Ports system automatically tries to elevate a users permission to root whenever they try to perform a port action while they haven't got the right privileges. I'm not much a fan of this system because of two reasons.. First it invites the user to try out passwords to gain permissions (sort off) but second: it also doesn't check if the user actually has permissions to use su at all, which results in a somewhat sloppy error:

Code:
macron:/usr/ports/misc/mc $ make config
===>  Switching to root credentials to create /var/db/ports/misc_mc
su: Sorry
===> Cannot create /var/db/ports/misc_mc, check permissions
*** Error code 1

Stop.
make: stopped in /usr/ports/misc/mc
I'd rather see that it doesn't try to switch at all but simply gives out the permission error.

I traced this behavior back to /usr/ports/Mk/bsd.port.mk but can't find anything conclusive here. I did come across INSTALL_AS_USER but that's only checked during some actions, not all. So when I have this set and try to use make rmconfig it stops trying to elevate my permissions and only gives me an error. So far, so good.

But the very moment I try to run make config I'm back to square one again.

So is there a way to turn this behavior off so that the Ports system doesn't try to use su at all?
 
On my workstation I've changed permissions of /var/db/ports so that my regular user can write to it. make config doesn't require superuser privileges then.

While I haven't had any problems with it so far, I don't know if there any unintended consequences to this. I'm thinking that there must be some or /var/db/ports would have other permissions by default.

Looking at bsd.port.mk and where it uses SU_CMD I think you should be good if you combine that with INSTALL_AS_USER.
 
Back
Top