Sample Header Ad - 728x90

unshare --map-root-user switch to original uid/username after setup

13 votes
2 answers
6526 views
I'm using unshare to create per process mounts, which is working perfectly fine by unshare -m --map-root-user However, after having created my bind-mounts by mount --bind src dst I want to change the UID to my original user, so that whoami (and others) echoes my username like echo $USER does. I have already tried the answer of https://unix.stackexchange.com/questions/66084/simulate-chroot-with-unshare/303660 However, doing su – user1 after chroot /, I get su: Authentication failure (Ignored) setgid: Invalid argument I have tested this on Ubuntu 18.04 Beta, Debian stretch, openSUSE-Leap-42.3. It's all the same. I guess something has changed in the kernel since this answer was working. What is a working and correct way to do that (of course without beeing **real** root)?
Asked by spawn (359 rep)
Apr 26, 2018, 10:46 AM
Last activity: May 14, 2024, 10:10 AM