summaryrefslogtreecommitdiff
path: root/ec2-fetch-credentials.py
diff options
context:
space:
mode:
authorChuck Short <zulcss@ubuntu.com>2009-02-24 21:06:31 +0000
committerBazaar Package Importer <jamesw@ubuntu.com>2009-02-24 21:06:31 +0000
commitecc2046ac6f51196bc0aa2d940aa64b5a789060c (patch)
treeda9a2362c36734705a7970eec7e02eccf338d302 /ec2-fetch-credentials.py
parent440f3288c5b75fde6d4e9a2b4a67510edc9b6e80 (diff)
downloadvyos-cloud-init-ecc2046ac6f51196bc0aa2d940aa64b5a789060c.tar.gz
vyos-cloud-init-ecc2046ac6f51196bc0aa2d940aa64b5a789060c.zip
* debian/ec2-set-apt-sources.py:
- Use the ec2 mirrors. (LP: #317065, #333897) - Update the /etc/apt/sources.list (LP: #333904) * debian/ec2-fetch-credentials.py: - Better error checking (LP: #325067)
Diffstat (limited to 'ec2-fetch-credentials.py')
-rwxr-xr-xec2-fetch-credentials.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/ec2-fetch-credentials.py b/ec2-fetch-credentials.py
index 1e91bef8..e8216ec4 100755
--- a/ec2-fetch-credentials.py
+++ b/ec2-fetch-credentials.py
@@ -37,6 +37,9 @@ os.umask(077)
if not os.path.exists('/home/ubuntu/.ssh'):
os.mkdir('/home/ubuntu/.ssh')
+if not os.path.exists('/root/.ssh'):
+ os.mkdir('/root/.ssh')
+
fp = open('/home/ubuntu/.ssh/authorized_keys', 'a')
fp.write(''.join(['%s\n' % key for key in keys]))
fp.close()
@@ -44,6 +47,6 @@ fp.close()
os.system('chown -R ubuntu:ubuntu /home/ubuntu/.ssh')
fp = open('/root/.ssh/authorized_keys', 'a')
-fp.write("command=\"echo;echo \'Please use the \"ubuntu\" user to login on this host instead of \"root\".\'echo;sleep 10\"")
-fp.write('',join(['%s\n' % key for key in keys]))
+fp.write("command=\"echo \'Please ssh to the ubuntu user on this host instead of root\';echo;sleep 10\" ")
+fp.write(''.join(['%s\n' % key for key in keys]))
fp.close()