Fix 960: Disable root login (sudo still works) (#962)

This commit is contained in:
Oliver Smith 2017-12-02 08:19:11 +00:00 committed by GitHub
parent 159f0d27fc
commit 30d1a5cada
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -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)