- self.g.write('/etc/group', '\n'.join(group) + '\n')
-
- # Remove home directories
- for home in [field[5] for field in removed_users.values()]:
- if self.g.is_dir(home) and home.startswith('/home/'):
- self.g.rm_rf(home)
-
- def data_cleanup_passwords(self, print_header=True):
- """Remove all passwords and lock all user accounts"""
-
- if print_header:
- output('Cleaning up passwords & locking all user accounts')
-
- shadow = []
-
- for line in self.g.cat('/etc/shadow').splitlines():
- fields = line.split(':')
- if fields[1] not in ('*', '!'):
- fields[1] = '!'
-
- shadow.append(":".join(fields))
-
- self.g.write('/etc/shadow', "\n".join(shadow) + '\n')
-
- def data_cleanup_cache(self, print_header=True):