Skip to content

A small example showing how to launch a process in a namespaced chroot.

License

Notifications You must be signed in to change notification settings

eu90h/rust-namespace-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-namespace-example

This program is an ugly, C-like Rust translation of the C example at the bottom of man 2 clone with some extra additions to launch a namespaced bash process. The particularly tricky bit is to remember to set the uid/gid maps correctly after cloning the process (see man user_namespaces), otherwise stuff like chroot won't work. For more about namespaces, see Michael Kerrisk's Namespaces in Operation series.

Usage of the program requires two arguments: a hostname and a chroot path.

There are many resources out there on establishing a chroot. If you're on debian/ubuntu distros try sudo debootstrap stable <chroot_path>.

About

A small example showing how to launch a process in a namespaced chroot.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages