diff options
author | netblue30 <netblue30@yahoo.com> | 2016-07-29 09:37:51 -0400 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2016-07-29 09:37:51 -0400 |
commit | bdcb2be80f78082650283e13fcb9a90d75e02eba (patch) | |
tree | 16c5acb08efa77aa9bc78e55bad4b2fd93254f30 /mkuid.sh | |
parent | fix Makefile.in (diff) | |
download | firejail-bdcb2be80f78082650283e13fcb9a90d75e02eba.tar.gz firejail-bdcb2be80f78082650283e13fcb9a90d75e02eba.tar.zst firejail-bdcb2be80f78082650283e13fcb9a90d75e02eba.zip |
using UID_MIN/GID_MIN values from /etc/login.def
Diffstat (limited to 'mkuid.sh')
-rwxr-xr-x | mkuid.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mkuid.sh b/mkuid.sh new file mode 100755 index 000000000..f03fdaf94 --- /dev/null +++ b/mkuid.sh | |||
@@ -0,0 +1,20 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | echo "extracting UID_MIN and GID_MIN" | ||
4 | echo "#ifndef FIREJAIL_UIDS_H" > uids.h | ||
5 | echo "#define FIREJAIL_UIDS_H" >> uids.h | ||
6 | |||
7 | if [ -f /etc/login.defs ] | ||
8 | then | ||
9 | echo "// using values extracted from /etc/login.defs" >> uids.h | ||
10 | UID_MIN=`awk '/^\s*UID_MIN\s*([0-9]*).*?$/ {print $2}' /etc/login.defs` | ||
11 | GID_MIN=`awk '/^\s*GID_MIN\s*([0-9]*).*?$/ {print $2}' /etc/login.defs` | ||
12 | echo "#define UID_MIN $UID_MIN" >> uids.h | ||
13 | echo "#define GID_MIN $GID_MIN" >> uids.h | ||
14 | else | ||
15 | echo "// using default values" >> uids.h | ||
16 | echo "#define UID_MIN 1000" >> uids.h | ||
17 | echo "#define GID_MIN 1000" >> uids.h | ||
18 | fi | ||
19 | |||
20 | echo "#endif" >> uids.h | ||