Commit bf5fd3f5 authored by Mikhail Efremov's avatar Mikhail Efremov

features.in/live: Don't use nopasswdlogin group in all cases.

Use it only for gdm and lightdm and only if it is used in a PAM config.
parent 87847ba7
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
# * reset password for root # * reset password for root
# * add user `altlinux' (without password) # * add user `altlinux' (without password)
NPG="nopasswdlogin" GRPLIST="users scanner audio radio proc cdrom cdwriter wheel fuse"
GRPLIST="users scanner audio radio proc cdrom cdwriter wheel fuse $NPG"
verbose() verbose()
{ {
...@@ -15,7 +14,6 @@ verbose() ...@@ -15,7 +14,6 @@ verbose()
add_user() add_user()
{ {
verbose "Add $1 user" verbose "Add $1 user"
groupadd -r "$NPG"
local groups= local groups=
for g in $GRPLIST; do for g in $GRPLIST; do
if groupmod $g 2>/dev/null; then if groupmod $g 2>/dev/null; then
......
...@@ -7,6 +7,14 @@ fi ...@@ -7,6 +7,14 @@ fi
USER=altlinux USER=altlinux
add_nopasswdlogin_group()
{
[ -f "/etc/pam.d/$1" ] &&
egrep -qs '^auth.+user[[:blank:]]+ingroup[[:blank:]]+nopasswdlogin' "/etc/pam.d/$1" &&
groupadd -r nopasswdlogin &&
gpasswd -a "$USER" nopasswdlogin
}
## setup runlevel ## setup runlevel
INITTAB=/etc/inittab INITTAB=/etc/inittab
if [ -f "$INITTAB" ]; then if [ -f "$INITTAB" ]; then
...@@ -29,6 +37,7 @@ if [ -f "$LIGHTDM_CONF" ]; then ...@@ -29,6 +37,7 @@ if [ -f "$LIGHTDM_CONF" ]; then
-e "s/^#\(autologin-user=\).*$/\1$USER/" \ -e "s/^#\(autologin-user=\).*$/\1$USER/" \
-e "s/^#\(autologin-user-timeout=0\)/\1/" \ -e "s/^#\(autologin-user-timeout=0\)/\1/" \
"$LIGHTDM_CONF" "$LIGHTDM_CONF"
add_nopasswdlogin_group lightdm ||:
fi fi
## gdm2 autologin ## gdm2 autologin
...@@ -36,6 +45,7 @@ GDM_CONF=/etc/X11/gdm/custom.conf ...@@ -36,6 +45,7 @@ GDM_CONF=/etc/X11/gdm/custom.conf
if [ -f "$GDM_CONF" ]; then if [ -f "$GDM_CONF" ]; then
sed -i -e '/\[daemon\]/aAutomaticLoginEnable=true\nAutomaticLogin='$USER \ sed -i -e '/\[daemon\]/aAutomaticLoginEnable=true\nAutomaticLogin='$USER \
"$GDM_CONF" "$GDM_CONF"
add_nopasswdlogin_group gdm ||:
fi fi
## kdm3 autologin ## kdm3 autologin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment