Skip to content

Commit d05f019

Browse files
committed
auto-login the newly created VM user immediately, otherwise vagrant user
would still be logged in This reverts commit 0272b9c.
1 parent 38f7f7d commit d05f019

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

scripts/setup-vm-user.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,15 @@ usermod -a -G adm,cdrom,sudo,dip,plugdev,lpadmin,sambashare $LOGIN_USER
1616

1717
# ensure the new user can do passwordless sudo
1818
echo "$LOGIN_USER ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$LOGIN_USER
19+
20+
# set the new user as the default in the login screen and end the current (vagrant) user's gnome session
21+
mkdir -p /etc/gdm3
22+
> /etc/gdm3/custom.conf
23+
echo "[daemon]" >> /etc/gdm3/custom.conf
24+
echo "# Enabling automatic login" >> /etc/gdm3/custom.conf
25+
echo "AutomaticLoginEnable = true" >> /etc/gdm3/custom.conf
26+
echo "AutomaticLogin = $LOGIN_USER" >> /etc/gdm3/custom.conf
27+
28+
if [[ $(which gnome-session) ]]; then
29+
systemctl restart display-manager
30+
fi

0 commit comments

Comments
 (0)