Unix Programming - sftp script

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > October 2005 > sftp script





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author sftp script
gino

2005-10-28, 4:53 pm

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

gino

2005-10-28, 4:53 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

Bit Twister

2005-10-28, 4:53 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
gino

2005-10-28, 4:53 pm

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

Bit Twister

2005-10-28, 4:53 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
gino

2005-10-28, 4:53 pm

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

Bit Twister

2005-10-28, 4:53 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)

gino

2005-10-28, 4:53 pm

:D thanks a lot also for trick!

Robert Harris

2005-10-28, 4:53 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
joe@invalid.address

2005-10-28, 4:53 pm

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

> On 28 Oct 2005 06:23:18 -0700, gino wrote:
>
> 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
Bill Marcum

2005-10-30, 5:51 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.
Bill Marcum

2005-10-30, 5:51 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!
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com