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

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

  1. cwncool macrumors newbie

    Joined:
    Sep 3, 2007
    #1
    I've use a terminal command to create a SOCKS proxy through my ssh server (ex. ssh -D 2008 -l user server.here), 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

    phatqao

    Joined:
    Jul 20, 2010
    Location:
    PA and/or NYC
    #2
    you could write an applescript along the lines of
    Code:
    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

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #3
    For AppleScript it would need to run as administrator
    Code:
    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

    Joined:
    Jul 11, 2006
    #4
    Code:
    #!/bin/bash
    
    ssh -D 2008 -l user server.here
    
    Save this on your Desktop as a file named "StartSSH" (or whatever you like).

    Make it executable by typing the following in Terminal:

    Code:
    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

    Joined:
    Sep 3, 2007
    #5
    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

    Joined:
    Jul 11, 2006
    #6
    Google. Maybe start here.
     

Share This Page