[olug] Simple local network script

Sean Kelly smkelly at zombie.org
Sun Jun 18 01:58:34 UTC 2006


On Sat, Jun 17, 2006 at 08:23:08PM -0500, Jack wrote:
> Sorry to bother you guys (and gals?), but I could use a simple script 
> for the following:
> 
>     I am using sftp to move files from one computer to another in my 
> home network.  I use MandrivaLinux 2006 on both machines.
>     I always enter in the same commands on the same machine.  The 
> commands are:
> 
> sftp 192.168.1.214
> (then I put in the password and when I am in the sftp shell I type:)
> put /home/jd/Sneakernet/* /home/jd/Sneakernet
> bye

First off, you could be using `scp` instead of `sftp`. SCP is a
non-interactive way to copy files with SSH. So, you'd change the above by
doing:

$ scp /home/jd/Sneakernet/* @192.168.1.214:/home/jd/Sneakernet

As for eliminating the password, I'd suggest you look into building a new
SSH key without a password. This article describes it:
http://www.linuxjournal.com/article/8600

So, as for a simple shell script... Something along the lines of:
--SNIP--
#!/bin/sh
/usr/bin/scp ~jd/Sneakernet/* @192.168.1.214:~jd/Sneakernet/
--SNIP--

-- 
Sean Kelly         | PGP KeyID: D2E5E296
smkelly at zombie.org | http://www.zombie.org



More information about the OLUG mailing list