summaryrefslogtreecommitdiff
path: root/ec2-fetch-credentials.py
diff options
context:
space:
mode:
Diffstat (limited to 'ec2-fetch-credentials.py')
-rwxr-xr-xec2-fetch-credentials.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ec2-fetch-credentials.py b/ec2-fetch-credentials.py
index 7c89d9f0..fc9f984c 100755
--- a/ec2-fetch-credentials.py
+++ b/ec2-fetch-credentials.py
@@ -23,9 +23,10 @@ import pwd
import ec2init
def setup_user_keys(keys, user, key_prefix):
+ saved_umask = os.umask(077)
+
pwent = pwd.getpwnam(user)
- os.umask(077)
if not os.path.exists('%s/.ssh' % pwent.pw_dir):
os.mkdir('%s/.ssh' % pwent.pw_dir)
@@ -36,6 +37,8 @@ def setup_user_keys(keys, user, key_prefix):
os.chown(authorized_keys, pwent.pw_uid, pwent.pw_gid)
+ os.umask(saved_umask)
+
def main():
ec2 = ec2init.EC2Init()