]> git.siccegge.de Git - forks/vmdebootstrap.git/commitdiff
Create password-less accounts when requested
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>
Mon, 16 Jul 2012 13:40:52 +0000 (14:40 +0100)
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>
Mon, 16 Jul 2012 13:40:52 +0000 (14:40 +0100)
vmdebootstrap

index c8fc426c1d8ec295fc150069beb63980a7cdac43..93bb2c6bce46b44760450e181cb79d84c16296da 100755 (executable)
@@ -237,7 +237,7 @@ class VmDebootstrap(cliapp.Application):
             self.runcmd(['chroot', rootdir, 'passwd', '-l', 'root'])
         else:
             self.message('Give root an empty password')
-            self.runcmd(['chroot', rootdir, 'passwd', '-d', 'root'])
+            self.delete_password(rootdir, 'root')
 
     def create_users(self, rootdir):
         def create_user(user):
@@ -253,11 +253,15 @@ class VmDebootstrap(cliapp.Application):
                 self.set_password(rootdir, user, password)
             else:
                 create_user(userpass)
+                self.delete_password(rootdir, userpass)
 
     def set_password(self, rootdir, user, password):
         encrypted = crypt.crypt(password, '..')
         self.runcmd(['chroot', rootdir, 'usermod', '-p', encrypted, user])
 
+    def delete_password(self, rootdir, user):
+        self.runcmd(['chroot', rootdir, 'passwd', '-d', user])
+
     def remove_udev_persistent_rules(self, rootdir):
         self.message('Removing udev persistent cd and net rules')
         for x in ['70-persistent-cd.rules', '70-persistent-net.rules']: