Best practice to mimic a linux rootfs without root permission on an existing system
1
vote
0
answers
421
views
I have access to a user account of a ubuntu server. However it's really inconvenient to work without root permission (which means that cannot install packages) and I am more familiar with archlinux than ubuntu. I think that I can run a container or chroot under my user directory and simulate the root access in it. Here are some possibilities (as far as I know):
1. Run a LXC. It requires complex configuration and I haven't tried that.
2. Use proot. Here is what I've tried:
fakeroot tar -xzf archlinux-bootstrap-x86_64.tar.gz --numeric-owner
to rootfs.x86_64
and proot -S rootfs.x86_64
. But when I tried to run some command like pacman-key --init
I get strange error ==> ERROR: pacman configuration file '/etc/pacman.conf' not found.
- The file is there and the program fail to find it. When running other commands the problem is similar.
3. Use bwrap. I tried bwrap --unshare-all --share-net --bind root.x86_64 / --dev /dev --proc /proc --tmpfs /tmp --uid 0 --gid 0 bash
. This time the issue is like I don't have permissions when doing lots of things. Like when running su
I get su: cannot set groups: Operation not permitted
.
So what's the best practice to do this? Sorry for I don't know what this behavior is actually called so I have to describe it in this awkward way.
Asked by Yutsing
(11 rep)
Oct 14, 2023, 07:39 AM