From 10566be6205cb18574b684b8a24025e040d1fa59 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 29 May 2012 19:05:15 -0400 Subject: [PATCH] ~ expansion is unreliable on Solaris 10. --- ssh-installkeys | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ssh-installkeys b/ssh-installkeys index 74c602b..d675b45 100755 --- a/ssh-installkeys +++ b/ssh-installkeys @@ -1957,7 +1957,7 @@ class KeyConfig(ConfigParser.RawConfigParser): if self.have_config: self.write(open(KeyConfig.configfile(), "w")) def remember(self, session): - authorized = session.ssh("cat ~/.ssh/authorized_keys") + authorized = session.ssh("cat $HOME/.ssh/authorized_keys") keydict = {} for line in authorized.split("\n"): if line: @@ -2109,19 +2109,19 @@ if __name__ == '__main__': session = ssh_session(login, port, host, verbose=verbose) # Permissions checks - fixperms(session, "~", check) - forcefile(session, "~/.ssh", "mkdir ~/.ssh", check) - fixperms(session, "~/.ssh", check) + fixperms(session, "$HOME", check) + forcefile(session, "$HOME/.ssh", "mkdir $HOME/.ssh", check) + fixperms(session, "$HOME/.ssh", check) # OK, install keys remotely if they don't exist - if session.exists("~/.ssh/authorized_keys"): + if session.exists("$HOME/.ssh/authorized_keys"): print "authorized_keys already exists on %s, cannot append to it." % host config.remember(session) elif check: print "Check of %s@%s is complete." % (login, host) else: print "Copying your public keys to", host - session.scp(keyfile, "~/.ssh/authorized_keys") + session.scp(keyfile, "$HOME/.ssh/authorized_keys") config.remember(session) print "Keys for %s@%s have been installed." % (login, host) except SystemExit: -- 2.43.0