Replace grep with getent in entrypoint.sh
Use native "getent" command to get entries from NSS insead of "grep".
This commit is contained in:
parent
ec5648f6c5
commit
ce10038546
|
@ -12,14 +12,14 @@ if [ "$MSF_UID" -eq "0" ]; then
|
||||||
else
|
else
|
||||||
# if the users group already exists, create a random GID, otherwise
|
# if the users group already exists, create a random GID, otherwise
|
||||||
# reuse it
|
# reuse it
|
||||||
if ! grep ":$MSF_GID:" /etc/group > /dev/null; then
|
if ! getent group $MSF_GID > /dev/null; then
|
||||||
addgroup -g $MSF_GID $MSF_GROUP
|
addgroup -g $MSF_GID $MSF_GROUP
|
||||||
else
|
else
|
||||||
addgroup $MSF_GROUP
|
addgroup $MSF_GROUP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if user id already exists
|
# check if user id already exists
|
||||||
if ! grep ":$MSF_UID:" /etc/passwd > /dev/null; then
|
if ! getent passwd $MSF_UID > /dev/null; then
|
||||||
adduser -u $MSF_UID -D $MSF_USER -g $MSF_USER -G $MSF_GROUP $MSF_USER
|
adduser -u $MSF_UID -D $MSF_USER -g $MSF_USER -G $MSF_GROUP $MSF_USER
|
||||||
# add user to metasploit group so it can read the source
|
# add user to metasploit group so it can read the source
|
||||||
addgroup $MSF_USER $METASPLOIT_GROUP
|
addgroup $MSF_USER $METASPLOIT_GROUP
|
||||||
|
|
Loading…
Reference in New Issue