Set shell, switch to passwordless sudo

This commit is contained in:
Ian Gulliver
2016-04-29 18:55:13 +00:00
parent 5fded8255e
commit 70dd367261

View File

@@ -39,10 +39,11 @@ def ExecChroot(*args, **kwargs):
def main():
ExecChroot('adduser', '--system', '--group', '--disabled-password',
FLAGS.username)
'--shell=/bin/bash', FLAGS.username)
if FLAGS.sudo:
ExecChroot('usermod', '--append', '--groups', 'sudo', FLAGS.username)
with open(os.path.join(FLAGS.chroot_path, 'etc', 'sudoers.d', FLAGS.username), 'w') as fh:
fh.write('%s\tALL=(ALL) NOPASSWD: ALL\n')
if FLAGS.authorized_keys_file:
dest_dir = os.path.join(FLAGS.chroot_path, 'home', FLAGS.username, '.ssh')