mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 01:13:05 +00:00
fhs-userenv: Make it work on kernel < 3.19 cc @abbradar
It may not be very secure, but I think it's better to make it work with older kernel since 3.19 is not the default on nixos.
This commit is contained in:
parent
7711446298
commit
b1adfeb23d
@ -79,7 +79,11 @@ if $cpid == 0
|
||||
$unshare.call CLONE_NEWNS | CLONE_NEWUSER
|
||||
|
||||
# Map users and groups to the parent namespace
|
||||
write_file '/proc/self/setgroups', 'deny'
|
||||
begin
|
||||
# setgroups is only available since Linux 3.19
|
||||
write_file '/proc/self/setgroups', 'deny'
|
||||
rescue
|
||||
end
|
||||
write_file '/proc/self/uid_map', "#{uid} #{uid} 1"
|
||||
write_file '/proc/self/gid_map', "#{gid} #{gid} 1"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user