From 30d1a5cada010922e52f7e2e7698deecec1398d1 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sat, 2 Dec 2017 08:19:11 +0000 Subject: [PATCH] Fix 960: Disable root login (sudo still works) (#962) --- pmb/install/install.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pmb/install/install.py b/pmb/install/install.py index 160da745..72a249bf 100644 --- a/pmb/install/install.py +++ b/pmb/install/install.py @@ -117,10 +117,12 @@ def set_user(args): pmb.chroot.root(args, ["addgroup", args.user, "wheel"], suffix) -def set_user_password(args): +def setup_login(args): """ - Loop until the passwords for user and root have been changed successfully. + Loop until the password for user has been set successfully, and disable root + login. """ + # User password logging.info(" *** SET LOGIN PASSWORD FOR: '" + args.user + "' ***") suffix = "rootfs_" + args.device while True: @@ -132,6 +134,9 @@ def set_user_password(args): " one more time.") pass + # Disable root login + pmb.chroot.root(args, ["passwd", "-l", "root"], suffix) + def copy_ssh_key(args): """ @@ -315,7 +320,7 @@ def install(args): pmb.chroot.initfs.build(args, flavor, suffix) # Set the user password - set_user_password(args) + setup_login(args) # Set the keymap if the device requires it setup_keymap(args)