adding some new scripts and updated hack(le)s

This commit is contained in:
brent s
2018-11-03 02:37:19 -04:00
parent 6f450ab68f
commit 33043a3499
4 changed files with 232 additions and 2 deletions

View File

@@ -12,9 +12,9 @@ def copyKeys(keystring, user = 'root'):
homedir = os.path.expanduser('~{0}'.format(user))
sshdir = '{0}/.ssh'.format(homedir)
authfile = '{0}/authorized_keys'.format(sshdir)
os.makedirs(sshdir, mode = 0o700, exist_ok = True)
with open(authfile, 'a') as f:
f.write(keystring)
os.makedirs(sshdir, mode = 0o700, exist_ok = True)
for basedir, dirs, files in os.walk(sshdir):
os.chown(basedir, uid, gid)
os.chmod(basedir, 0o700)
@@ -28,4 +28,4 @@ def main():
copyKeys(keys.read().decode('utf-8'))
if __name__ == '__main__':
main()
main()