The USER_HOME variable might not result in a single line/value
emrahkaya opened this issue · comments
The
USER_HOME="$(getent passwd | awk '{ FS=":" } /'"$SUDO_USER"'/ {print $6}')"
line in enter-systemd-namespace
may result in multiple entries if the value of $SUDO_USER
present in multiple lines.
For example, assume that the $SUDO_USER
is bus
and a section of the getent passwd
is as follows :
bus:x:9:9:bus:/home/bus:/usr/sbin/nologin
xbus:x:118:125::/var/lib/xbus:/bin/false
Then USER_HOME will be set to
/home/bus
/var/lib/xbus
To solve it,
the reg. ex. in awk command should be changed to '"^$SUDO_USER:"'
Great suggestion! I have made a pull request and am waiting for a review, but I think that won't be a problem!
And it's merged :-)