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

Double-click remote connectivity (with SSH) UNIX
I am lazy and don't like to type ssh me@wherever.com whenever I want to log in to a remote server to check my mail.

So, using the Terminal I created an executable file like this:
echo 'ssh myusername@server.com' > click_me
chmod 755 click_me
Then, from the Finder, get info on the file 'click_me' and set the default application to Terminal. Double-click and voila!

Even better: put the 'click_me' file in your startup applications, and your prompt will be ready and waiting at login.
    •    
  • Currently 2.33 / 5
  You rated: 5 / 5 (3 votes cast)
 
[8,094 views]  

Double-click remote connectivity (with SSH) | 7 comments | Create New Account
Click here to return to the 'Double-click remote connectivity (with SSH)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An even faster hint for using ssh
Authored by: sreilly on Apr 29, '01 01:36:58PM

You can also use the ssh-agent program so that you can enter your
RSA key passphrase once and never have to enter it again (until you
reboot, at least). The ssh-agent program runs in the background
and keeps track of your passphrase. When you ssh to another machine,
ssh checks with the ssh-agent program to see if your RSA private key
is available. If so, it uses it to authenticate with the remote host
and logs you in without ever having to enter a password.

Note: This only works with RSA authentication (which is more secure
than normal secret key authentication anyway, so everyone should
use it!)

There are many different ways to set this up. I did it like this:

1) Add the following two lines to the .cshrc file in your home folder:
alias setupssh 'ssh-agent | head -2 > ~/.ssh_settings ; source ~/.ssh_settings ; ssh-add'
source ~/.ssh_settings

2) When you first login, or start the computer, at the command-line run:
setupssh

It will start the ssh-agent program in the background and (if you have generated
an RSA public/private key pair) will ask you for your private key passphrase.
If you enter your passphrase you will be able to ssh to any computer that
has your RSA public key without re-entering your passphrase.




[ Reply to This | # ]
much easier GUI way to do this!
Authored by: jmil on Apr 30, '01 04:41:56PM

While it's nice to be able to do things from the terminal, Apple has thought ahead and made it really easy to do all you want and more:

Open Terminal. Select:
>Shell>Run Command... (or type Command-Shift-N)
Type your command of choice (e.g. "ssh me@myfavoritedomain.edu")
A new terminal window will open with this command running. Customize the window ANY way you want using the Terminal Inspector:
>Shell>Inspector... (Command-I)
You can set font, colors, custom title, window size, etc. It will even remember the position of the window!
Now just save the window:
>Shell>Save As... (Command-Shift-S)
Save it wherever you want. You can also click the box that says "Open this file when Terminal starts up" or set this in Terminal Preferences (Click the "Startup" Pane in Terminal Preferences, and set the file in the "Startup File" option).
That's it. This will work with any executable in Terminal!



[ Reply to This | # ]
much easier GUI way to do this!
Authored by: tali on May 01, '01 02:17:57AM

That's great! I've been looking for a way to do this for a while! Now the question is, can I launch this shell from the terminal without having to go to the menu?

I want to be able to launch with one word commands different ssh sessions on other unix machines that pop up on my mac color-coded and with the appropriate title on the window.

You've brought me nearly there. Do you know how to run these "shellname.term" files from the terminal? I tried making them executable but that did not work...



[ Reply to This | # ]
much easier GUI way to do this!
Authored by: quentinsf on May 01, '01 06:15:20AM
Do you know how to run these "shellname.term" files from the terminal? I tried making them executable but that did not work...

The open command will do this for you. Have a look at its man page.


Quentin



[ Reply to This | # ]
re:much easier GUI way to do this!
Authored by: tali on May 01, '01 01:46:37PM

thanks! The open command was what I needed.

Now I have three different terminals with different title bars and colors letting me know what server they are from, and I can pop them up from the command line. I have the ssh key set up on the servers, so I don't have to give a password either. Just one command. Sweet!


-tali



[ Reply to This | # ]
set up an alias
Authored by: jmil on May 01, '01 09:57:54PM

you can write an alias so all you have to do is type a string like "connect", or anything you really want, and it will run any command of your choice. You will have to edit /private/etc/csh.cshrc as root. To avoid using emacs, vi, or anything else that is hard to understand, just type the following:
su
(enter your administration password here)

open -a /Applications/TextEdit.app/ /private/etc/csh.cshrc
(this tells the terminal to open csh.cshrc with TextEdit.app)

you should see a line that says "source /usr/share/init/tcsh/rc"
all you have to do is think of an alias, and type it in. Here is an example:

alias myfavorite "open /Users/myusername/Library/Terminal/mycustomterminal.term"

this creates the alias "myfavorite" such that when you type "myfavorite" in a terminal window, the terminal will execute the command in quotes and will thus open mycustomterminal.term. You won't have to type "open /Users/myusername/...." ever again!

edit until you're happy with your aliases. You could also add another command to this file such as:

alias myaliases "open -a /Applications/TextEdit.app/ /private/etc/csh.cshrc"
This will allow you to simply type su to become superuser, and then "myaliases" to open your csh.cshrc file in TextEdit.app.

Now File>Save

Now all you have to do is tell the terminal to recognize your new commands. you could restart the terminal, or simply type

source /private/etc/csh.cshrc

this will execute the csh.cshrc file, and the terminal will recognize your new aliases as commands. Now just type "myfavorite" anytime you want to execute that command.
If it doesn't work for some reason, just type "source /private/etc/csh.cshrc" again, or check that your syntax in csh.cshrc is correct.

Using aliases can make your work in the terminal extremely efficient, but also dangerous if you don't know what you're doing. I WOULDN'T recommend trying to combine "sudo" with any aliases you try to create. I hope this is clear. Let me know if it isn't, or if you need more help. Good Luck.

jmil



[ Reply to This | # ]
more tips
Authored by: jmil on May 01, '01 10:04:36PM

clarification:
aliases you add should each be on their own line, if you didn't know this already.
also, you can always type "alias" from any terminal window to see a list of aliases the system will recognize. After following my directions in my previous post, you should see your new aliases in this list. Hope that helps.

jmil



[ Reply to This | # ]