cmd_ssh: ~ is not always /home

On OS-X, in particular, ~foo expands to /Users/foo . We delegate
everything to os.path.expanduser(), which should know the local
convention.
This commit is contained in:
Brian Warner 2016-08-15 17:24:05 -07:00
parent 75d362f60a
commit 899e539cb1

View File

@ -84,7 +84,7 @@ def invite(cfg, reactor=reactor):
if cfg.ssh_user is None: if cfg.ssh_user is None:
ssh_path = expanduser('~/.ssh/'.format(cfg.ssh_user)) ssh_path = expanduser('~/.ssh/'.format(cfg.ssh_user))
else: else:
ssh_path = '/home/{}/.ssh/'.format(cfg.ssh_user) ssh_path = expanduser('~{}/.ssh/'.format(cfg.ssh_user))
auth_key_path = join(ssh_path, 'authorized_keys') auth_key_path = join(ssh_path, 'authorized_keys')
if not exists(auth_key_path): if not exists(auth_key_path):
print("Note: '{}' not found; will be created".format(auth_key_path)) print("Note: '{}' not found; will be created".format(auth_key_path))