Re: OpenBSD fakeroot

2020-10-03 Thread Ingo Schwarze
Hi Richard,

Richard Ipsum wrote on Sat, Oct 03, 2020 at 02:35:16PM +0200:
> On Sat, Oct 03, 2020 at 02:21:45PM +0200, Ingo Schwarze wrote:
>> Richard Ipsum wrote on Sat, Oct 03, 2020 at 01:14:07PM +0200:

>>> I needed fakeroot for some tests I'm writing,

>> You are not really explaining what it is that you actually
>> want to do...
>> 
>> So i'm guessing a bit:
>> 
>>   https://manpages.debian.org/buster/fakeroot/fakeroot.1.en.html
>> 
>> says:
>> 
>>   fakeroot runs a command in an environment wherein it appears to
>>   have root privileges for file manipulation. This is useful for
>>   allowing users to create archives (tar, ar, .deb etc.) with files
>>   in them with root permissions/ownership.

> Yeah that's exactly what sfakeroot does. Like I say I looked into
> porting fakeroot, but it was way too complicated for me to be honest.
 
>> If that is what you need, then the OpenBSD facility serving the
>> same purpuse is documented here:
>> 
>>   https://man.openbsd.org/mount.8#noperm

> Someone told me about that, but I couldn't see how to use it without
> already being root (in order to mount an fs with noperm).
> Maybe I missed something though?

Well, of course, if a machine is to be used for such a purpose,
then of course a system administrator of the machine has to allow
it.  That's the whole purpose of system administration, deciding
what a machine and its various parts can be used for, and by whom.
In this case, root needs to allocate a partition, create a file
system, and mount it with the desired permissions.

But after that, normal users can use the configured resources
in the way they are configured, at any time.

That's not very different from other kinds of making resources
available.  For example, if the system administrator does not enable
kern.audio.record, you cannot use the microphone, if they do not
mount a file system, normal users cannot access the disk partition,
or if the system administrator doesn't create an account for you,
you can't even log in...

Yours,
  Ingo



Re: OpenBSD fakeroot

2020-10-03 Thread Richard Ipsum
On Sat, Oct 03, 2020 at 02:21:45PM +0200, Ingo Schwarze wrote:
> Hi Richard,

Hi Ingo,

> 
> Richard Ipsum wrote on Sat, Oct 03, 2020 at 01:14:07PM +0200:
> 
> > I needed fakeroot for some tests I'm writing,
> 
> You are not really explaining what it is that you actually
> want to do...
> 
> So i'm guessing a bit:
> 
>   https://manpages.debian.org/buster/fakeroot/fakeroot.1.en.html
> 
> says:
> 
>   fakeroot runs a command in an environment wherein it appears to
>   have root privileges for file manipulation. This is useful for
>   allowing users to create archives (tar, ar, .deb etc.) with files
>   in them with root permissions/ownership.

Yeah that's exactly what sfakeroot does. Like I say I looked into
porting fakeroot, but it was way too complicated for me to be honest.

> 
> If that is what you need, then the OpenBSD facility serving the
> same purpuse is documented here:
> 
>   https://man.openbsd.org/mount.8#noperm
> 
> Yours,
>   Ingo

Someone told me about that, but I couldn't see how to use it without
already being root (in order to mount an fs with noperm).
Maybe I missed something though?

Thanks,
Richard



Re: OpenBSD fakeroot

2020-10-03 Thread Ingo Schwarze
Hi Richard,

Richard Ipsum wrote on Sat, Oct 03, 2020 at 01:14:07PM +0200:

> I needed fakeroot for some tests I'm writing,

You are not really explaining what it is that you actually
want to do...

So i'm guessing a bit:

  https://manpages.debian.org/buster/fakeroot/fakeroot.1.en.html

says:

  fakeroot runs a command in an environment wherein it appears to
  have root privileges for file manipulation. This is useful for
  allowing users to create archives (tar, ar, .deb etc.) with files
  in them with root permissions/ownership.

If that is what you need, then the OpenBSD facility serving the
same purpuse is documented here:

  https://man.openbsd.org/mount.8#noperm

Yours,
  Ingo



Re: OpenBSD fakeroot

2020-10-03 Thread Tom Smyth
Ok

root as in user as opposed to root as in location in filesystem

Thanks Richard...

On Sat, 3 Oct 2020 at 12:49, Richard Ipsum  wrote:
>
> Hi,
>
> Sorry I'm not sure I understand, but anyway as far as I know you have to be
> root already to use chroot, and the main goal of fakeroot is to avoid
> having to become root when you don't really need to. So fakeroot just
> gives the appearances of being root without actually running anything
> as root.
>
> Thanks,
> Richard
>
> On Sat, Oct 03, 2020 at 12:30:30PM +0100, Tom Smyth wrote:
> > Hi Richard,
> > pardon my ignorance but would chroot with  a copy of  the / and sub
> > directories,  do the same thing ?
> >
> > thanks
> >
> > On Sat, 3 Oct 2020 at 12:30, Richard Ipsum  wrote:
> > >
> > > Hi,
> > >
> > > I needed fakeroot for some tests I'm writing, but it seemed to be Linux
> > > only and looked like it would be hard to port.
> > >
> > > So I've written a fakeroot clone for OpenBSD, it's not complete but it
> > > does enough to be useful to me personally, if anyone's interested the
> > > code is here: https://git.vx21.xyz/sfakeroot/
> > >
> > > Since OpenBSD's coreutils are statically linked and it needs LD_PRELOAD
> > > to work you'll probably want to use it with sbase[1] to be able to do
> > > anything useful.
> > >
> > > Thanks,
> > > Richard
> > >
> > > [1]: https://git.suckless.org/sbase/
> > >
> >
> >
> > --
> > Kindest regards,
> > Tom Smyth.



-- 
Kindest regards,
Tom Smyth.



Re: OpenBSD fakeroot

2020-10-03 Thread Richard Ipsum
Hi,

Sorry I'm not sure I understand, but anyway as far as I know you have to be
root already to use chroot, and the main goal of fakeroot is to avoid
having to become root when you don't really need to. So fakeroot just
gives the appearances of being root without actually running anything
as root.

Thanks,
Richard

On Sat, Oct 03, 2020 at 12:30:30PM +0100, Tom Smyth wrote:
> Hi Richard,
> pardon my ignorance but would chroot with  a copy of  the / and sub
> directories,  do the same thing ?
> 
> thanks
> 
> On Sat, 3 Oct 2020 at 12:30, Richard Ipsum  wrote:
> >
> > Hi,
> >
> > I needed fakeroot for some tests I'm writing, but it seemed to be Linux
> > only and looked like it would be hard to port.
> >
> > So I've written a fakeroot clone for OpenBSD, it's not complete but it
> > does enough to be useful to me personally, if anyone's interested the
> > code is here: https://git.vx21.xyz/sfakeroot/
> >
> > Since OpenBSD's coreutils are statically linked and it needs LD_PRELOAD
> > to work you'll probably want to use it with sbase[1] to be able to do
> > anything useful.
> >
> > Thanks,
> > Richard
> >
> > [1]: https://git.suckless.org/sbase/
> >
> 
> 
> -- 
> Kindest regards,
> Tom Smyth.



Re: OpenBSD fakeroot

2020-10-03 Thread Tom Smyth
Hi Richard,
pardon my ignorance but would chroot with  a copy of  the / and sub
directories,  do the same thing ?

thanks

On Sat, 3 Oct 2020 at 12:30, Richard Ipsum  wrote:
>
> Hi,
>
> I needed fakeroot for some tests I'm writing, but it seemed to be Linux
> only and looked like it would be hard to port.
>
> So I've written a fakeroot clone for OpenBSD, it's not complete but it
> does enough to be useful to me personally, if anyone's interested the
> code is here: https://git.vx21.xyz/sfakeroot/
>
> Since OpenBSD's coreutils are statically linked and it needs LD_PRELOAD
> to work you'll probably want to use it with sbase[1] to be able to do
> anything useful.
>
> Thanks,
> Richard
>
> [1]: https://git.suckless.org/sbase/
>


-- 
Kindest regards,
Tom Smyth.



OpenBSD fakeroot

2020-10-03 Thread Richard Ipsum
Hi,

I needed fakeroot for some tests I'm writing, but it seemed to be Linux
only and looked like it would be hard to port.

So I've written a fakeroot clone for OpenBSD, it's not complete but it
does enough to be useful to me personally, if anyone's interested the
code is here: https://git.vx21.xyz/sfakeroot/

Since OpenBSD's coreutils are statically linked and it needs LD_PRELOAD
to work you'll probably want to use it with sbase[1] to be able to do
anything useful.

Thanks,
Richard

[1]: https://git.suckless.org/sbase/