sftp script

  • Follow


Hi at all,
I'm Nicola.

I'd like to know how i can create an automatic sftp access.
I can't administer the user and password prompt.
My little example/idea:

#!/bin/sh

(
 echo "my_password";
 sleep 3
) | sftp my_user@213.123.123.2

.......but it doesn't work!

Any solutions?
thanks

0
Reply milella_ (2) 10/28/2005 12:31:40 PM

........in general I'd like to administer script that prompt any
information to insert in.
For example , how can i create an automatic user changing with "su -"
command??

my idea:
#! /bin/sh

(echo "root_passwd") | su -

.....but it doesn't work!!

thanks again

0
Reply gino 10/28/2005 12:37:11 PM


On 28 Oct 2005 05:31:40 -0700, gino wrote:
> Hi at all,
> I'm Nicola.
>
> I'd like to know how i can create an automatic sftp access.

Hmm,

$ man -k dialogue | grep interactive
expect  (1)  - programmed dialogue with interactive programs
0
Reply Bit 10/28/2005 12:58:32 PM

ok thanks....but in general is my idea correct?? see my second post!

0
Reply gino 10/28/2005 1:04:24 PM

On 28 Oct 2005 06:04:24 -0700, gino wrote:
> ok thanks....but in general is my idea correct?? see my second post!

Saw it before posting my reply. 
Did your script work?   :)

also do a 
man autoexpect

autoexpect - generate an Expect script from watching a session
0
Reply Bit 10/28/2005 1:07:13 PM

unfortunately doesn't exist "expect" in my unix SunOs.
Anyway my last posted doesn't work!

0
Reply gino 10/28/2005 1:23:18 PM

On 28 Oct 2005 06:23:18 -0700, gino wrote:
> unfortunately doesn't exist "expect" in my unix SunOs.

Ask the system admin to add expect and autoexpect.
Tell him, it wil be used for automating regression testing
applications.   :(

If you tell him that you want to hardcode a passord in a script,
he'll reject it because of the security violations of putting
passwords in a script. (hint, hint)   :(

0
Reply Bit 10/28/2005 1:29:34 PM

:D  thanks a lot also for trick!

0
Reply gino 10/28/2005 1:40:47 PM

gino wrote:
> Hi at all,
> I'm Nicola.
> 
> I'd like to know how i can create an automatic sftp access.
> I can't administer the user and password prompt.
> My little example/idea:
> 
> #!/bin/sh
> 
> (
>  echo "my_password";
>  sleep 3
> ) | sftp my_user@213.123.123.2
> 
> ......but it doesn't work!
> 
> Any solutions?
> thanks
> 
sftp isn't designed for scripting. If you want to script a file copy 
over a secure connection, use scp instead.

Robert
0
Reply Robert 10/28/2005 2:48:19 PM

Bit Twister <BitTwister@mouse-potato.com> writes:

> On 28 Oct 2005 06:23:18 -0700, gino wrote:
> > unfortunately doesn't exist "expect" in my unix SunOs.
> 
> Ask the system admin to add expect and autoexpect.
> Tell him, it wil be used for automating regression testing
> applications.   :(
> 
> If you tell him that you want to hardcode a passord in a script,
> he'll reject it because of the security violations of putting
> passwords in a script. (hint, hint)   :(

Gee, that's a good idea, do something you know is insecure and lie to
the admin about it. On second thought, it sounds more like bad job
security.

The ability to script things like this without having to store
passwords in filesis built into the ssh toolset. If you've got sftp
then you've got ssh-agent. 

I recommend "SSH The Secure Shell" by Barrett and Silverman (O'Reilly)
if you're going to be using the ssh toolset. Also see (besides the man
pages) 

http://www.snailbook.com/faq/no-passphrase.auto.html

Joe
-- 
Gort, klatu barada nikto
0
Reply joe 10/28/2005 2:50:40 PM

On 28 Oct 2005 05:37:11 -0700, gino 
  <milella_@inwind.it> wrote:
> .......in general I'd like to administer script that prompt any
> information to insert in.
> For example , how can i create an automatic user changing with "su -"
> command??
>
> my idea:
> #! /bin/sh
>
> (echo "root_passwd") | su -
>
> ....but it doesn't work!!
>
> thanks again
>
man sudo
man expect

-- 
She sells cshs by the cshore.
0
Reply Bill 10/30/2005 1:39:02 PM

On 28 Oct 2005 05:31:40 -0700, gino 
  <milella_@inwind.it> wrote:
> Hi at all,
> I'm Nicola.
>
> I'd like to know how i can create an automatic sftp access.
> I can't administer the user and password prompt.
> My little example/idea:
>
>
> Any solutions?
> thanks
>
man ssh-keygen


-- 
I'm pretending that we're all watching PHIL SILVERS instead of RICARDO
MONTALBAN!
0
Reply Bill 10/30/2005 1:39:32 PM

11 Replies
575 Views

(page loaded in 0.158 seconds)

Similiar Articles:


















7/22/2012 9:13:09 PM


Reply: