Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Create quick-access ssh shortcuts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create quick-access ssh shortcuts
Authored by: dogzilla on Aug 11, '06 09:46:28PM

With the solutions above, I believe you will still have to enter a password. I get tired of entering passwords all the time when I ssh into another machine, since I have to do it *all* the time on a bunch of different machines. Instead, I've created the following process:

1) create a new file in ~/bin (create this directory if it doesn't exist)
2) modify the following and enter it into the file:
<code>
#!/usr/bin/expect --
spawn ssh some.server.name
expect "Password:"
send "somepassword\r"
interact
</code>
Obviously, "some.server.name", "Password:", and "somepassword" should be changed to reflect the specific instance of your setup. (The trailing "\r" should remain). You can even use this to su after login by including additional expect / send blocks.
3) give the file some easily remembered name (avoid spaces)
4) change the permissions for the file so it's executable: (from the command line, you would do this by typing "chmod 700 ~/bin/somefile")
5) close and open your terminal or type "rehash" at the command line

You should now be able to simply type the name of the file and be connected to the server. You can also duplicate & rename the file and edit it for other server connections. This method has worked quite well for me - I type a single word and I'm automatically connected to the server.



[ Reply to This | # ]
Create quick-access ssh shortcuts
Authored by: statistics on Aug 12, '06 12:27:10AM
I would think that SSHKeychain would be a more secure way to achieve this convenience.

[ Reply to This | # ]
Create quick-access ssh shortcuts
Authored by: rpaul on Aug 12, '06 06:56:59AM

You can even embed this into an anchor on a web page/sidebar menu - works well with Safari:

<a href="ssh://user@host.com">user@host.com</a>

Very cool!



[ Reply to This | # ]
Do you work for the gov.t, or a bank?
Authored by: klktrk on Aug 14, '06 09:27:55AM

The author of this comment appears to work for the govt or a bank, 'cause I can't imagine a private person being this irresponsible with data. Once someone gets into your home folder (not at all difficult) they can have a field day with any machine you administer via SSH. Typing SSH passwords into text files in plain text is beyond me. I simply cannot fathom the mental process which would allow someone to do that. You might as well just lie down in the middle of a freeway.



[ Reply to This | # ]
Create quick-access ssh shortcuts
Authored by: oliverlangan on Aug 21, '06 05:26:37PM
I also had the same problem of having to enter passwords all the time, but I think a cleaner (and built-into-ssh) way than putting actual passwords into text files is to set up an ssh identity (using ssh-keygen), and then putting the public key for that identity on all the machines you want to log into. It takes some initial setup, but it is much more secure and even works when the account password to the machine changes (it is using the key to negotiate the encryption, not the password).

The key will also be used automatically for SFTP (including in programs like Interarchy, Transmit, etc) and can be used to log into multiple accounts with different logins on the target machines.

There are some good how-to documents on setting this up, e.g.,
http://www.zettai.net/Support/Howto/sshKeyHowto


[ Reply to This | # ]