How to transfer data remotely to PCs in LAN via SFTP?

This is a discussion on How to transfer data remotely to PCs in LAN via SFTP? within the Linux Networking forums, part of the Linux Forums category; Hi, I want to automate transferring file or folder to 20 PCs connected via the same LAN.. The problem i ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-22-2007
Ahmad
 
Posts: n/a
Default How to transfer data remotely to PCs in LAN via SFTP?

Hi,

I want to automate transferring file or folder to 20 PCs connected via
the same LAN..

The problem i face is that they need to enter password and i don't
know how to pass it in the code syntax..

Sample Code:
for i in (1:20) # 20 PCs
do
sftp user(at)10.0.0.$i # to log-in remotely to PCs one by one
# Password should be entered here!! How to ??
put $file ; # transfer the file to destination PC
exit # come back to current shell
done # will go to log-in to the next PC

I want to either override password promot, or find a way to pass it
automatically to the standard input ..

P.S. I have the root password and everything.

Can anyone help me please? I'm not a programmer in fact, so if you see
that my code is weak, please correct it to me..

Thanks in advance,
Ahmad,

Reply With Quote
  #2 (permalink)  
Old 03-22-2007
Allen McIntosh
 
Posts: n/a
Default Re: How to transfer data remotely to PCs in LAN via SFTP?

> The problem i face is that they need to enter password and i don't
> know how to pass it in the code syntax..


The last thing you want to do is put a cleartext password in a shell
script. If you want maximum security, use ssh-agent (Read The Fine
Manual page; it tells you everything you need to know). Using a key
with no passphrase (Read The Fine Manual page for ssh-keygen) or a
~/.shosts file will also do what you want, though with less security.
It all depends on your environment: how well the hosts can trust each
other etc.
Reply With Quote
  #3 (permalink)  
Old 03-22-2007
Kalyan Manchikanti
 
Posts: n/a
Default Re: How to transfer data remotely to PCs in LAN via SFTP?

On Mar 22, 7:19 am, "Ahmad" <ahmad.abdulgh...@gmail.com> wrote:
> Hi,
>
> I want to automate transferring file or folder to 20 PCs connected via
> the same LAN..
>
> The problem i face is that they need to enter password and i don't
> know how to pass it in the code syntax..
>
> Sample Code:
> for i in (1:20) # 20 PCs
> do
> sftp user(at)10.0.0.$i # to log-in remotely to PCs one by one
> # Password should be entered here!! How to ??
> put $file ; # transfer the file to destination PC
> exit # come back to current shell
> done # will go to log-in to the next PC
>
> I want to either override password promot, or find a way to pass it
> automatically to the standard input ..
>
> P.S. I have the root password and everything.
>
> Can anyone help me please? I'm not a programmer in fact, so if you see
> that my code is weak, please correct it to me..
>
> Thanks in advance,
> Ahmad,


google for "passwordless ssh" to set up your ssh key authentication .
sftp uses ssh to transfer files. If you want to do this as root ( and
still disable direct logins as root the directive in sshd_config you
need to use is "PermitRootLogin without-passwowrd "( after setting up
the ssh keys for the root user that is..)..




Reply With Quote
  #4 (permalink)  
Old 03-22-2007
Ahmad
 
Posts: n/a
Default Re: How to transfer data remotely to PCs in LAN via SFTP?

On Mar 22, 3:56 pm, "Kalyan Manchikanti"
<kalyan.manchika...@gmail.com> wrote:
> On Mar 22, 7:19 am, "Ahmad" <ahmad.abdulgh...@gmail.com> wrote:
>
>
>
> > Hi,

>
> > I want to automate transferring file or folder to 20 PCs connected via
> > the same LAN..

>
> > The problem i face is that they need to enter password and i don't
> > know how to pass it in the code syntax..

>
> > Sample Code:
> > for i in (1:20) # 20 PCs
> > do
> > sftp user(at)10.0.0.$i # to log-in remotely to PCs one by one
> > # Password should be entered here!! How to ??
> > put $file ; # transfer the file to destination PC
> > exit # come back to current shell
> > done # will go to log-in to the next PC

>
> > I want to either override password promot, or find a way to pass it
> > automatically to the standard input ..

>
> > P.S. I have the root password and everything.

>
> > Can anyone help me please? I'm not a programmer in fact, so if you see
> > that my code is weak, please correct it to me..

>
> > Thanks in advance,
> > Ahmad,

>
> google for "passwordless ssh" to set up your ssh key authentication .
> sftp uses ssh to transfer files. If you want to do this as root ( and
> still disable direct logins as root the directive in sshd_config you
> need to use is "PermitRootLogin without-passwowrd "( after setting up
> the ssh keys for the root user that is..)..

Hi,
This was my first post to this wonderfull forum!
I really got tired searching and trying to remotely transfer data to
group of PCs on a LAN using a shell script to perform passwordless
sftp transmission..
I am looking for help from someone that can give me the 1,2,3,.. steps
to do it.
And i am not a linux expert, :(
My problem is:
I want to make a script (function) that takes file path on current
host (i work on) and then loops on 20 PCs that has IPs from 10.10.13.1
through 10.10.13.20 and copy that file to the "user" homes.

How can i do it (please in details)
I know it may be bad to ask for that, but it's really urgent and i'm
not specialized in doing such stuff!!

BTW, I already googled and did my best, and tried somethings, but
unfortunately, all stuff failed to achieve what i seek!!!

Thanks a lot in advance,
Ahmad,

Reply With Quote
  #5 (permalink)  
Old 03-22-2007
Mark Atherton
 
Posts: n/a
Default Re: How to transfer data remotely to PCs in LAN via SFTP?

Ahmad wrote:

As Kalyan says, you need to set up ssh using RSA authentication. There
are good explanations on the web. Then, depending on what you want to do:

scp -r directorytotransfer host1:/home/todirectory/

or

rsync -vaxe ssh directorytotransfer host1:/home/todirectory/

Mark Atherton
Reply With Quote
  #6 (permalink)  
Old 03-25-2007
Matthias Fassl
 
Posts: n/a
Default Re: How to transfer data remotely to PCs in LAN via SFTP?

Ahmad wrote:
> On Mar 22, 3:56 pm, "Kalyan Manchikanti"
> <kalyan.manchika...@gmail.com> wrote:
>> On Mar 22, 7:19 am, "Ahmad" <ahmad.abdulgh...@gmail.com> wrote:
>>
>>
>>
>>> Hi,
>>> I want to automate transferring file or folder to 20 PCs connected via
>>> the same LAN..
>>> The problem i face is that they need to enter password and i don't
>>> know how to pass it in the code syntax..
>>> Sample Code:
>>> for i in (1:20) # 20 PCs
>>> do
>>> sftp user(at)10.0.0.$i # to log-in remotely to PCs one by one
>>> # Password should be entered here!! How to ??
>>> put $file ; # transfer the file to destination PC
>>> exit # come back to current shell
>>> done # will go to log-in to the next PC
>>> I want to either override password promot, or find a way to pass it
>>> automatically to the standard input ..
>>> P.S. I have the root password and everything.
>>> Can anyone help me please? I'm not a programmer in fact, so if you see
>>> that my code is weak, please correct it to me..
>>> Thanks in advance,
>>> Ahmad,

>> google for "passwordless ssh" to set up your ssh key authentication .
>> sftp uses ssh to transfer files. If you want to do this as root ( and
>> still disable direct logins as root the directive in sshd_config you
>> need to use is "PermitRootLogin without-passwowrd "( after setting up
>> the ssh keys for the root user that is..)..

> Hi,
> This was my first post to this wonderfull forum!
> I really got tired searching and trying to remotely transfer data to
> group of PCs on a LAN using a shell script to perform passwordless
> sftp transmission..
> I am looking for help from someone that can give me the 1,2,3,.. steps
> to do it.
> And i am not a linux expert, :(
> My problem is:
> I want to make a script (function) that takes file path on current
> host (i work on) and then loops on 20 PCs that has IPs from 10.10.13.1
> through 10.10.13.20 and copy that file to the "user" homes.
>
> How can i do it (please in details)
> I know it may be bad to ask for that, but it's really urgent and i'm
> not specialized in doing such stuff!!
>
> BTW, I already googled and did my best, and tried somethings, but
> unfortunately, all stuff failed to achieve what i seek!!!
>
> Thanks a lot in advance,
> Ahmad,



http://www.mattfoster.clara.co.uk/ssh-pam.htm

That's a Step-by-Step tutorial which explains what you have to do for a
passwordless ssh-login/scp-transfer.

Matthias
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:36 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0