build ports from not a root user?

Daniel Staal DStaal at
Thu Jul 21 17:19:41 UTC 2011

On Thu, July 21, 2011 11:30 am, Peter Vereshagin wrote:
> You'll never silence the voice of the voiceless, freebsd-questions!
> 2011/07/21 11:04:57 -0400 Daniel Staal <DStaal at> => To
> freebsd-questions at :
> DS> > I'd like to build my ports from not a root user.
> DS> > How can I tell the ports system that it should su ( switch user )
> before
> DS> > to
> DS> > build the dependencies?
> DS> > Can portupgrade handle this?
> DS> > Dependencies should be installed from a root user.
> DS>
> DS> Install sudo, and (as long as your permissions are set correctly) the
> DS> ports system can do everything except the install and configure from a
> DS> user in the 'wheel' group.
> Heck I know I can use su or sudo and after
>     chown -Rf user00:group00 /usr/ports/ /usr/src/ /usr/obj
> I can build world or a single port with 'make'. It's easy.
> But with ports I know the dependencies will not follow my policy to
> install the
> every single port as:
>     $ cd /usr/ports/category/port00
>     $ make
>     $ su -
>     # cd /usr/ports/category/port00
>     # make install
>     # exit
>     $ cd /usr/ports/category/port01
>     ... and so on ...

No, it'll _build_ each port as your user, and then try to go to root to
install them.  Which is why I suggested sudo: You can tune it's timeouts,
and only have to enter your password occasionally.  (Why do you trust a
port's dependencies to be built as root if you don't trust the port
itself, after all?)

The other option would be to do something like this:

$ su -
# make depends
# exit
$ make
$ su -
# make install

Which should be fairly close to what you are saying.

Daniel T. Staal

This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.

More information about the freebsd-questions mailing list