diff options
-rwxr-xr-x | modules/openssh/templates/ldap-sshkey2file.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/openssh/templates/ldap-sshkey2file.py b/modules/openssh/templates/ldap-sshkey2file.py index 1c474038..475030ec 100755 --- a/modules/openssh/templates/ldap-sshkey2file.py +++ b/modules/openssh/templates/ldap-sshkey2file.py @@ -90,6 +90,11 @@ def write_keys(keys, user, uid, gid): os.chmod(tmpname, 0600) os.chown(tmpname, uid, gid) shutil.move(tmpname, keyfile) + # Hmm, aparently shutil.move does not preserve user/group so lets reapply + # them. I still like doing it before as this should be more "automic" + # if it actually worked, so it's "good practice", even if shutil.move sucks + os.chown(keyfile, uid, gid) + os.chmod(keyfile, 0600) return True return False |