Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if Linux user namespaces are supported by current OS kernel

After doing some reading, I found that Linux user namespaces are generally supported in Linux versions >= 3.8. However, there's a possibility that user namespaces are disabled on a given OS, making the check for kernel versions unreliable. Is there a robust way to check if the current OS I'm using supports user namespaces and has it available to use?

like image 906
Jonathan Ng Avatar asked Aug 29 '16 20:08

Jonathan Ng


1 Answers

You could check if your current process' /proc/[pid]/ns/ directory has a file called user:

ls /proc/self/ns
like image 90
njam Avatar answered Oct 13 '22 12:10

njam