Skip to content

Instantly share code, notes, and snippets.

@mrunalp
Created June 26, 2014 21:57
Show Gist options
  • Save mrunalp/75d922aafe0fbbc1a73b to your computer and use it in GitHub Desktop.
Save mrunalp/75d922aafe0fbbc1a73b to your computer and use it in GitHub Desktop.
[root@localhost rootfs]# nsinit exec /bin/bash
2014/06/26 21:50:00 EXEC USERNS
2014/06/26 21:50:00 &{MountConfig:0xc21001e3c0 Hostname:koye User:root WorkingDir: Env:[HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOSTNAME=koye TERM=xterm] Tty:true Namespaces:map[NEWIPC:true NEWNET:true NEWNS:true NEWPID:true NEWUTS:true NEWUSER:true] Capabilities:[CHOWN DAC_OVERRIDE FOWNER MKNOD NET_RAW SETGID SETUID SETFCAP SETPCAP NET_BIND_SERVICE SYS_CHROOT KILL] Networks:[0xc21004e310] Routes:[] Cgroups:0xc21000f6e0 AppArmorProfile: ProcessLabel: RestrictSys:true UidMappings:[{ContainerId:0 HostId:1013 Size:1} {ContainerId:1 HostId:1 Size:1012}] GidMappings:[{ContainerId:0 HostId:1013 Size:1} {ContainerId:1 HostId:1 Size:1012}]}
2014/06/26 21:50:00 1
2014/06/26 21:50:00 proc: &{6 0 0}
2014/06/26 21:50:00 uid: [{ContainerId:0 HostId:1013 Size:1} {ContainerId:1 HostId:1 Size:1012}]
2014/06/26 21:50:00 0 1013 1
1 1 1012
2014/06/26 21:50:00 0 1013 1
1 1 1012
bash-4.2# ps -ef
UID PID PPID C STIME TTY TIME CMD
65534 1 0 0 21:49 ? 00:00:00 nsinit init /bin/bash
root 6 1 0 21:49 ? 00:00:00 /bin/bash
root 7 6 0 21:50 ? 00:00:00 ps -ef
bash-4.2# hostname
koye
bash-4.2# id
uid=0(root) gid=0(root) groups=0(root)
bash-4.2#
bash-4.2# cat /proc/$$/uid_map
0 1013 1
1 1 1012
bash-4.2# cat /proc/$$/gid_map
0 1013 1
1 1 1012
bash-4.2#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment