Re: Sheell Script for SFTP

From: Ian East (ian.east_at_gmail)
Date: 09/01/05


Date: Thu, 01 Sep 2005 12:28:26 -0700

On Thu, 1 Sep 2005 20:05:18 +0530, "Venkat" <khvenkat@cisco.com>
wrote:

>Hi All,
>
>I am looking for a shell script for SFTP a file and not prompting for the
>password.
>I wrote the small script but it doesn't work. I am trying to download the
>file by name test located at /root directory on System with IP 10.77.31.202.
>The userid and password of 10.77.31.202 is root and venkat. Could some one
>correct this please.
>
>#! /bin/sh
>
>HOST='10.77.31.202'
>USER='root'
>PASSWD='venkat'
>
>ftp $HOST
>user ${USER} ${PASSWD}
>
>cd /root/
>get test
>
>exit 0
>
>
>Regards,
>Venkat
>
Have you tried using a here document? I'm not that familiar with
sftp, but perhaps you could make this more secure and get around the
password by using RSA authentication.

#! /bin/sh

HOST='10.77.31.202'
USER='root'
PASSWD='venkat'

ftp $HOST<<EOF
user ${USER} ${PASSWD}

cd /root/
get test

exit 0
EOF



Relevant Pages

  • Sheell Script for SFTP
    ... I am looking for a shell script for SFTP a file and not prompting for the ... Regards, ...
    (alt.os.linux.redhat)
  • Re: OpenSSH question : password prompt when scripting
    ... carry over to the shell script. ... Does your shell script only contain the line: sftp ... Subject: OpenSSH question: password prompt when scripting ... But if I run the exact same command as a script, ...
    (AIX-L)
  • sftp non interactive session
    ... I want to use sftp in a cron job (shell script) so obvously I do not want to ... I have seen solutions such as using ...
    (comp.unix.solaris)
  • Re: sftp non interactive session
    ... > I want to use sftp in a cron job (shell script) so obvously I do not want to ... Lazy Canadian. ...
    (comp.unix.solaris)
  • Re: Sheell Script for SFTP
    ... I would give up trying to right a shell script to interact ... with interactive programs. ... There's too many pitfalls. ... Look at the man page for sftp, I'm not sure what you're trying to do ...
    (alt.os.linux.redhat)