How to login to a user namespace created by unshare?

How to login to a user namespace created by unshare -U from another terminal?

Asked By: Franc M

||

there’s no such thing as "logging in to a user namespace"; a user namespace is not a virtual machine running a login interface, or something similar!

You can, however, execute a process, for example a shell, in that existing user namespace:

nsenter --target $(pidof process_running_in_the_unshare) /usr/bin/zsh
Answered By: Marcus Müller
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.