Your best friend for file transfer.

Fetch application logoFetch

SFTP connection with Applescript (4 posts)

  • Started 16 years ago by MrScripter
  • Latest reply 16 years ago from Scott McGuire
  • MrScripter Member

    I am having a problem opening a SFTP connection while using Applescript to run Fetch.

    *** The facts (generalized to hide names) ***
    -Using Fetch 5.2
    -Can open a FTP connection to my site hosted on Yahoo using Applescript with the command: set thisWindow to make new transfer window at beginning with properties {hostname:"ftp.MYWEBSITENAME.com", username:"MYWEBSITENAME@ MYWEBSITENAME.com", initial folder:"db/"}
    - Can open a SFTP connection to my FMS host using the New Connection window in Fetch (See transcript below) with the fields set as: Hostname: MYACCT.rtmpfmshost.com, Username: MYACCT, Connect Using: SFTP, Enable Encryption: Checked, Password: MYPASSWORD, Initial Folder: streams/_definst_, Port: 22
    - Can NOT open the same SFTP connection (see transcript below) to my FMS host using Applescript with the command: set thisWindow to make new transfer window at beginning with properties {hostname:" MYACCT.rtmpfmshost.com", username:"MYACCT", port:"22", authentication:"SFTP", protocol:"SFTP", password:"MYPASSWORD", initial folder:"streams/_definst_"}

    *** The Transcripts (I have changed my acct name from the name to MYACCT everywhen in the transcript)***
    Transcript when connecting to SFTP using the New Connection window.

    Connecting to MYACCT@MYACCT.rtmpfmshost.com port 22 (7/24/07 3:05:51 PM)
    SSH2_FXP_INIT 3
    SSH2_FXP_REALPATH 1, .
    /gfvitmj1
    SSH2_FXP_STAT 2, /MYACCT
    SSH2_FXP_REALPATH 3, /MYACCT/streams/_definst_/
    /MYACCT/streams/_definst_
    SSH2_FXP_STAT 4, /MYACCT/streams/_definst_
    SSH2_FXP_OPENDIR 5, /MYACCT/streams/_definst_
    SSH2_FXP_READDIR 6
    0 Jul 24, 2007 10:09 ./
    0 Jul 24, 2007 10:09 ../
    42447 Jul 24, 2007 08:33 _10571.flv
    274239 Jul 23, 2007 05:04 _11529.flv

    Transcript when connecting to SFTP using Applescript:

    Connecting to MYACCT.rtmpfmshost.com port 22 (Mac OS X firewall is off) (7/24/07 3:08:56 PM)
    Connected to XX.XX.XX.7 port 22 (7/24/07 3:08:56 PM)
    SSH-2.0-VShell_2_3_6_263 VShell

    At this point it just sits there. I can cancel the connection by clicking the X, but it never connects.

    The transcripts are a bit different. It seems when using Applescript, it is not sending the username or something? When it works manually, it is sending Connecting to MYACCT@MYACCT.rtmpfmshost.com and when it does not work it sends Connecting to MYACCT.rtmpfmshost.com.

    Any ideas?

    Thanks.

    Posted 16 years ago #

  • Scott McGuire Administrator

    Hi,

    The problem is that "SFTP" should not be in quotes for the authentication property. And in fact, you do not need to include the protocol or port properties.

    So this AppleScript command should work for you:

    set thisWindow to make new transfer window at beginning with properties {hostname:"MYACCT.rtmpfmshost.com", authentication:SFTP, username:"MYACCT", initial folder:"treams/_definst_"}

    While you can include the password as a property in the AppleScript, it's more secure to store the password in your keychain, where it will be stored in encrypted format and Fetch will read it automatically, than to store the password in the AppleScript, where it will be stored as plain text.

    Please let us know if this does not work for you, or if you have further questions.

    Thanks,

    Scott McGuire
    Fetch Softworks

    Posted 16 years ago #

  • MrScripter Member

    Bingo! The quotes were the problem. Everything works great now.

    Thank you Scott.

    Posted 16 years ago #

  • Scott McGuire Administrator

    Hi,

    You're welcome, I'm glad to hear it's working for you now. Thanks for the followup.

    Best,

    Scott McGuire
    Fetch Softworks

    Posted 16 years ago #

Reply

  • Or nickname, if you prefer.
  • This will be kept confidential.
  • This is to ensure that you’re a person, not a spambot.