]> thyrsus.com Git - ssh-installkeys.git/commitdiff
~ expansion is unreliable on Solaris 10.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 29 May 2012 23:05:15 +0000 (19:05 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 29 May 2012 23:05:15 +0000 (19:05 -0400)
ssh-installkeys

index 74c602b9de4b27debe915bc4c24cebdef97f353a..d675b4525971c2343a1ce2cb469e2e2498e3662d 100755 (executable)
@@ -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: