• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: applescript shell script SCP?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: applescript shell script SCP?


  • Subject: Re: applescript shell script SCP?
  • From: "Mark J. Reed" <email@hidden>
  • Date: Mon, 8 Dec 2008 20:36:57 -0500

On Mon, Dec 8, 2008 at 7:46 PM, Mr. Dan Pouliot <email@hidden> wrote:
My goal is to sftp a file to a server (curl doesn't support sftp).
The problem is that SCP ..

OK, make up your mind.  Are you using SFTP or SCP?  The underlying mechanism is the same, but the whole point of SFTP is to provide an FTP-like interface on top of SCP.   So if you're using the "scp" command directly, then SFTP is no longer involved at all.

requires that the password be typed when prompted, after the initial command.

Assuming you're using password authentication and not public key authentication, yes.
 
I tried throwing the password after a semicolon to make it execute as line 2 of my shell script, but that yeilds error:

Because it's not a command.   When you type the password, you aren't typing to the shell, you're typing to scp.  The shell doesn't read the next line of the script until scp finishes doing its thing, at which point it's too late to enter the password (and all it does is make the shell look for a command whose name is your password, which it won't find - at least not unless you have a very poorly-chosen password.)

Your options:

1) Set up a public/private keypair so that scp operates without a password.   Somewhat complex to do the first time, but saves a lot of trouble later.

or

2) Install something like Fetch (http://www.fetchworks.com/), which speaks SFTP and has an AppleScript dictionary.

or

3) Use the expect command to script an interaction with scp.  Complicated and fragile; not recommended.

--
Mark J. Reed <email@hidden>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: applescript shell script SCP?
      • From: "Mark J. Reed" <email@hidden>
References: 
 >applescript shell script SCP? (From: "Mr. Dan Pouliot" <email@hidden>)

  • Prev by Date: Re: applescript shell script SCP?
  • Next by Date: Re: applescript shell script SCP?
  • Previous by thread: Re: applescript shell script SCP?
  • Next by thread: Re: applescript shell script SCP?
  • Index(es):
    • Date
    • Thread