summaryrefslogtreecommitdiffstats
path: root/core/modules/pam/data/etc/profile.d/00-user-env.sh
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/pam/data/etc/profile.d/00-user-env.sh')
-rw-r--r--core/modules/pam/data/etc/profile.d/00-user-env.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/modules/pam/data/etc/profile.d/00-user-env.sh b/core/modules/pam/data/etc/profile.d/00-user-env.sh
new file mode 100644
index 00000000..a2d10989
--- /dev/null
+++ b/core/modules/pam/data/etc/profile.d/00-user-env.sh
@@ -0,0 +1,14 @@
+#!/bin/ash
+
+# Stuff we might wanna know
+PWENT=
+[ -n "$UID" ] && PWENT=`getent passwd "$UID"`
+[ -z "$PWENT" ] && [ -n "$PAM_USER" ] && PWENT=`getent passwd "$PAM_USER"`
+if [ -n "$PWENT" ]; then
+ export USER=`echo "$PWENT" | awk -F ':' '{print $1}'`
+ export GID=`echo "$PWENT" | awk -F ':' '{print $4}'`
+ export HOME=`echo "$PWENT" | awk -F ':' '{print $6}'`
+ export GROUP=`id -gn`
+ export LOGNAME=$USER
+ export HOSTNAME=`hostname`
+fi