image
image

|

Ticket Options
Question Profile
DATESep 17, 2006
TICKET#28328
STATUSClosed
SUBJECTssh and running unix scripts from OSX
CATComputers, Operating Systems, Applications or Connected Devices
TYPEOperating System Features, Bugs and Problems
DESCApple
DESC10.4.X (Tiger)
PLATFORMApple Macintosh (PowerPC G3,G4,G5)
MODELApple/Powerbook
PROC1.67GHz
RAM1GB
DRIVE80G
NAMESheldon
USERNAMEunkey monkey
TECHNICALLots of Experience
ISSUESome Troubleshooting
Question Details
TICKET ARCHIVE -> ssh and running unix scripts from OSX
unkey monkey - Sep 17, 2006 - 6:28 pm
image
image
I need to create an ssh session to a server at work through which I will run VNC to control a server there.

Currently, I have a Unix script which I run from a terminal session. It prompts me for a password, then the ssh is running.

My quesion - Is there an easy way to either setup the ssh or at least run the unix script and type in my password without opening a terminal window?

Thanks,

Sheldon
TechSupport - Sep 20, 2006 - 6:30 pm
image
image
unkey monkey - Oct 3, 2006 - 9:49 pm
image
image
Nobody ever answered my question last time.
ScottW - Oct 4, 2006 - 6:41 am
image
image
Hello,

Quick question, then we can move forward.

Is the password being entered the SSH password to connect to the remote server, or is it a sudo password for the Mac?

If it is the first one, you can easily accomplish by using SSH keys. You would copy your key on your local machine, to your account on box your connecting to. Then, when you ssh over, it will not prompt you for a password and connect automatically.

Would this setup fix your issue? If so, I can explain how to do it.

Scott
unkey monkey - Oct 4, 2006 - 6:50 am
image
image
Scott,

Thanks for the reply.
The password is the SSH password, I think. It comes up from the remote box (I think it is a Linux box). It comes in response to running the Unix "ssh" command at a prompt in a terminal window on my MAC. It seems to me that it is the login process on the remote box.

Does that help?

Thanks,

Sheldon
ScottW - Oct 4, 2006 - 7:54 am
image
image
This is the page I use as my "reminder guide" when I want to accomplish password-less SSH.

http://pkeck.myweb.uga.edu/ssh/

What you will want to do, when you create your id-dsa, it will ask you to create a password or type one in, just hit for both and leave it blank. Then you will copy your public key up to the linux server following the instructions. Once you have done everything you should be able to ssh name@server.domain.com and it should connect w/o asking for any passwords.

This is ideal for if your running scripts that run over ssh, like rsyncing things at 2am when your snoozing and can't be around to type in a password.

You you have problems following the instructions or not having any luck, let me know. I can help out further.

Scott
unkey monkey - Oct 6, 2006 - 7:20 am
image
image
This was great help. Thanks.
My final challenge, now that I have the public/private key (dsa) thing working, is that I would like to run a script without opening a terminal window. I have a script file that basically opens an ssh tunnel with some port mapping settings. I didn't want to type the command into the terminal prompt each time, so I created a script, but now I don't even want to open a terminal session. Is there some way I can open the ssh without going into terminal and running the script file?
ScottW - Oct 7, 2006 - 10:03 am
image
image
I am sure there are more than one way to do what your asking. I would suggest a quick Applescript (or us Automator) to do make you want. This would be fairly simple to do. The Applescript can execute things on the command line without launching terminal. So, it would be as simple as double-clicking a saved Applescript to initiate your SSH connection... and then you could even have it fire up VNC and auto-connect if it is the same connection all the time.

I don't have time this weekend to walk you through that process. But I can later next week if you still need me too. You could start playing around with it all and see if you understand it. Otherwise, I'll be around to help out.

Scott
unkey monkey - Oct 7, 2006 - 3:16 pm
image
image
Scott,

Thanks for the reply.
I don't know that Automator can do this (at least I don't understand how as I thought it just automated applications), but I have tried writting an apple script, but so far it isn't working. The conceptual challenge that I have is that if there isn't an open shell, then how can the ssh stay open? here is what I have so far:

do shell script "ssh -X scott@xx.xx.xx.xx -C -L 5901:yyy.yyy.yyy.yyy:5901"

You can see that I am trying to re-map a port for VNC.

Anyway, it doesn't complain when I run the script, but it doesn't work either. Any help would be appreciated.

Thanks,

Sheldon
ScottW - Oct 10, 2006 - 4:51 am
image
image
When you run "ps -ax" in the terminal after you start the automator sequence, do you see your ssh connection. You could even do a "ps ax | grep 5901" to sort through the mess that will display on your screen.

I have actually done this before but I had to rebuild my system this weekend and I haven't restored all my files to reference exactly what I did. I will get back with you later today.

Scott
unkey monkey - Oct 13, 2006 - 7:56 am
image
image
Scott,

When I run ps, I see the process running the first time, but then after 2 seconds, if I run ps again, the process is no longer there. It seems to close out. I don't know if there is an error, but I don't see anything and I don't see any output.

I have put the same command line in a unix shell script and it works every time. Why can't the apple script do it with a "do shell script" command?
TechSupport - Oct 13, 2006 - 12:55 pm
image
image

IF THIS IS YOUR QUESTION AND YOU WISH TO RESPOND, LOGIN HERE FIRST.


Search Engine Friendly URLs by vBSEO 3.1.0