Mar 29, 2008, 05:11 AM
I'm not a savvy programmer to say the least, so please don't mock me ;)
Basicly I want the computer to do the following everytime I start up:
1. Start the terminal
2. Type in ssh -T -l [username] fw2.k-net.dk
3. Type in password (it will promt for password)
It would be much appreciated if someone could tell me how to do this.
Thanks in advance
Mar 29, 2008, 12:06 PM
Typing the password is not the answer. You would have to store it in the script, etc.
As such, I think using shared-key authentication would get rid of the need to type a password via automation and instead you would just need a 1 line script to make the connection. The setup is a bit more involved, but I think will satisfy your need in this instance.
There are instructions all over the place, but I just validated this on my own machine, here are the steps I followed:
On your mac, open the terminal and run:
ssh-keygen -t dsa
Do not enter a passphrase when prompted. Two files will be created in ~/.ssh. You need to copy the one called id_dsa.pub to the foreign system. For the sake of security, you should do this via scp. You need to place this file in ~/.ssh of the user you want to log in as on the foreign system.
Then log in to the foreign system, and:
cat id*.pub >> authorized_keys
You may have to
chmod 700 ~
due to permissions checking for security when using shared keys.
Once you've done this, when you ssh from your machine to the foreign machine, there should be no prompt for a password.
Then you can just create a text file with:
ssh -T -l user fw2.k-net.dk
Save the file as "remotelogin.sh" or whatever you'd like, and in the terminal chmod it to 700. When you run the script, it should log you in to the foreign system. You can then put a link or copy of the script in your dock, desktop, etc. and it will essentially be like opening a terminal on the foreign system.
Mar 29, 2008, 01:16 PM
Thanks for the reply
I'll give it a try :)