[OT] Re: Scp files to another server help

From: Mike Hunter (mhunter_at_uclink.berkeley.edu)
Date: 12/13/03


Date: Sat, 13 Dec 2003 00:59:44 +0000 (UTC)

On 12 Dec 2003 13:41:46 -0800, JoelAshton wrote:
> "Tintin" <me@privacy.net> wrote in message news:<br68g0$28enps$1@ID-172104.news.uni-berlin.de>...
> > "JennAshton" <> wrote in message
> > news:c5b9b407.0312081805.19193fd1@posting.google.com...
> > > Hi,
> > >
> > > I wrote a simple scp script from my server to pacman server which
> > > copies all jpg files to /jennash/ directory.
> > >
> > > Now, I need help with this script. I would like it to pull not just
> > > *.jpg files but other file types as well. Also, is it possible to pull
> > > only files that is 3 minutes old? Please help.
> > >
> > > Thanks!
> > >
> > > JennAsh
> > >
> > > #!/usr/bin/perl
> > >
> > > system('scp /export/www/docs/*.jpg pacman:/export/www/jennash/');
> > >
> > > exit;
> >
> > And the relevance to Perl is???
> >
> > Here's a shell script to do it:
> >
> > #!/bin/sh
> > scp `find /export/www/docs -type f -mmin 3` pacman:/export/www/jennash
>
>
> Well, seeing your shell script I was able to come up with this
> rsync -rt -e /usr/local/bin/ssh /htodcs/www/my_folder/
> pacman:/htdocs/www/remote_folder
>
> The above script allows me to execute via command line in Unix.
> However, when I saved the script has shell script and tried to
> executed via browser it didn't work.
>
> The page displays:
>
> We trust you have received the usual lecture from the local System
> Administrator. It usually boils down to these two things: #1) Respect
> the privacy of others. #2) Think before you type. Password:
>
>
> Not sure why it is displaying since the sys-admin open up ssh
> connection and a key has been established in my local directory in the
> remote server.
>
> Can anyone advise?

If you run it as a CGI, you'll be running it as a different user. I don't
know how your web server is set up, so I can't tell you how to fix it, but
you somehow need to get the script to run as the appropriate user, perhaps
using the "setuid" bit for the executable permission.

Mike



Relevant Pages

  • Re: OT: security
    ... this remote file will be included into ... the script and executed. ... Note that the remote server would have to ... Mechanisms such as the above allow attackers to execute any code they ...
    (comp.lang.php)
  • Re: pop-forum Re: poplog-dev A look at Poplog on the Macintosh
    ... with the poplink command. ... When trying to make pglink produce a 'sh' rather than a 'csh' shell ... script for linking and when trying to make it put unexpanded environment ... using the shell script pglibr, ...
    (comp.lang.pop)
  • Files appear to be cross linked
    ... script requires a number of standard environment variables to be set ... so it calls a second shell script to set these at the session level, ... control should return to the first shell script, ... that the script executes to the last line prior to the displaying of ...
    (comp.unix.solaris)
  • Re: [PHP] Catch STDERR
    ... into your PHP script? ... Or do you just need STDOUT in one variable, and STDERR in another, ... Another option is to try to write a .sh shell script to get what you ...
    (php.general)
  • Re: Newbie: Porting App from Windows
    ... The application's interface is in TCL and I just need to know the basics of ... the executable interaction with a shell script, ... >> assumign the paths are all working ok, woudl then execute the ...
    (comp.os.linux.development.apps)