• 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: SCP and terminal help needed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SCP and terminal help needed


  • Subject: Re: SCP and terminal help needed
  • From: Axel Luttgens <email@hidden>
  • Date: Tue, 29 Apr 2003 16:43:00 +0200

Charles Heizer wrote:

Hello,
I'm trying to write a script to automate coping files to remote hosts. But when I use SCP it does not work, but if I use SSH it works file. Has anyone gotten SCP to work using AppleScript. Oh yea, I really want to avoid using ssh keys for this solution.

I've included the syntax I'm using, if there is a problem with it I really could use some help.

Thanks!

- Charles


Syntax Using scp - (does not work)
do script "scp -r /Users/admin/Desktop/NetWorker.pkg " & theUser & "@" & theHost & ":/var/tmp"
delay 10
set thePrompt to last word of ((contents of window 1) as string)
if thePrompt is "no" then
do script "yes" in window 1
delay 5
end if
do script thePass in window 1
delay 5

Syntax Using ssh - (does work)
do script "ssh " & theUser & "@" & theHost
delay 10
set thePrompt to last word of ((contents of window 1) as string)
if thePrompt is "no" then -- asking us if we want to continue?
do script "yes" in window 1
delay 5
end if
do script thePass in window 1
delay 5


You didn't tell, but I suppose the above code fragments are to be enclosed within a 'tell application "Terminal"' block.
So, I did some tests to be sure to understand what you were asking.
It seems the general framework you are considering is:

tell application "Terminal"
do script "some command that interactively requires a password"
delay 10 -- some sufficient delay
do script "thepassword"
end tell

Well, in fact, I am surprised that this works with the ssh command...
In my opinion, the behavior to be expected is the one observed with scp.
(would be happy if someone had an explanation of why that works with ssh)

Now, it could perhaps be possible to achieve want you want by using GUI Scripting.
This would have the advantage to stay very close of your original idea: instead of using 'do script' to enter the password, you would just simulate keystrokes.
More infos may be found at: http://www.apple.com/applescript/GUI/


HTH,
Axel
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >SCP and terminal help needed (From: Charles Heizer <email@hidden>)

  • Prev by Date: Re: Error: Stack overflow
  • Next by Date: Machine ID
  • Previous by thread: SCP and terminal help needed
  • Next by thread: Applescript & Safari
  • Index(es):
    • Date
    • Thread