Running terminal command/connecting to ssh through dock icon...

Discussion in 'macOS' started by cwncool, Aug 18, 2010.

  1. cwncool macrumors newbie

    Sep 3, 2007
    I've use a terminal command to create a SOCKS proxy through my ssh server (ex. ssh -D 2008 -l user, to which I am then prompted to enter a password, and everything is connected.

    For the sake of ease of use (as I need to do this frequently), is there any way I can make a dock icon, or something along those lines, so I can just click it, it runs the command, I enter a password (or maybe even not?) and it's all set? I have tried setting up a workflow in automator to run a shell script, but it is unsuccessful, leaving me with "Run Shell Script failed: Pseudo-terminal will not be allocated because stdin is not a terminal."

    Thanks a bunch!
  2. phatqao macrumors member


    Jul 20, 2010
    PA and/or NYC
    you could write an applescript along the lines of
    do shell script "<path-to-your-script>"
    save that applescript as an application, then you can put its icon in the dock and click it to run.
  3. angelwatt Moderator emeritus


    Aug 16, 2005
    For AppleScript it would need to run as administrator
    do shell script "<path-to-your-script>" with administrator privileges
    See here for more details on using the do shell script command.
  4. LPZ macrumors 65816

    Jul 11, 2006
    ssh -D 2008 -l user
    Save this on your Desktop as a file named "StartSSH" (or whatever you like).

    Make it executable by typing the following in Terminal:

    chmod 755 ~/Desktop/StartSSH

    Then you should be able to double-click the file's icon and Terminal will launch and run the command. Works for me anyway. :)

    PS---Use an RSA keypair for better security and to avoid having to enter a password each time.
  5. cwncool thread starter macrumors newbie

    Sep 3, 2007
    Thanks for the helps guys.

    Hmm it would be convenient to not always need a password. Would you mind elaborating on using an RSA keypair? (I'm not sure where to begin...)
  6. LPZ macrumors 65816

    Jul 11, 2006
    Google. Maybe start here.

Share This Page