summaryrefslogtreecommitdiff
path: root/cloudinit/SshUtil.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-05-22 13:50:30 -0400
committerScott Moser <smoser@ubuntu.com>2012-05-22 13:50:30 -0400
commit663989da30d81ccfe74b285d6f27fd801c0f27f9 (patch)
treecc7ca8b7c550e94a16c3857638c7aa205fc287f2 /cloudinit/SshUtil.py
parent4d9722ba567a6ed2e355a464f67fddcad1717aa2 (diff)
downloadvyos-cloud-init-663989da30d81ccfe74b285d6f27fd801c0f27f9.tar.gz
vyos-cloud-init-663989da30d81ccfe74b285d6f27fd801c0f27f9.zip
support relative path in AuthorizedKeysFile
LP: #970071
Diffstat (limited to 'cloudinit/SshUtil.py')
-rw-r--r--cloudinit/SshUtil.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/cloudinit/SshUtil.py b/cloudinit/SshUtil.py
index 22f4f2fc..a081fbe8 100644
--- a/cloudinit/SshUtil.py
+++ b/cloudinit/SshUtil.py
@@ -155,6 +155,8 @@ def setup_user_keys(keys, user, key_prefix, log=None):
akeys = ssh_cfg.get("AuthorizedKeysFile", "%h/.ssh/authorized_keys")
akeys = akeys.replace("%h", pwent.pw_dir)
akeys = akeys.replace("%u", user)
+ if not akeys.startswith('/'):
+ akeys = os.path.join(pwent.pw_dir, akeys)
authorized_keys = akeys
except Exception:
authorized_keys = '%s/.ssh/authorized_keys' % pwent.pw_dir