PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > how to ssh or scp or sftp through PHP?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
how to ssh or scp or sftp through PHP?

Réponse
 
LinkBack Outils de la discussion
Vieux 10/02/2008, 04h25   #1
lawrence k
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut how to ssh or scp or sftp through PHP?


On the company's webserver we have two harddrives. Apache is aware of
one of those harddrives and serves websites from that harddrive. The
other harddrive is not reachable via the web. I've written some cron
jobs that make a backup of various MySql databases and saves a copy to
that second hard drive.

For added security, I'd love to have a cron job (on my home Ubuntu
machine) that runs each night and downloads all the backups to my home
machine. I thought I could write a bash shell script using scp to do
this, but I now find out that one has to jump through several hoops
(create private/public keys, etc) to do it.

I'm wondering if there is an easier way to download the files, using
PHP? Any thoughts on this?

  Réponse avec citation
Vieux 10/02/2008, 04h35   #2
McKirahan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to ssh or scp or sftp through PHP?

"lawrence k" <lkrubner@geocities.com> wrote in message
news:5b537a98-84ad-47fd-b1e4-2d1683b43572@v67g2000hse.googlegroups.com...
>
> On the company's webserver we have two harddrives. Apache is aware of
> one of those harddrives and serves websites from that harddrive. The
> other harddrive is not reachable via the web. I've written some cron
> jobs that make a backup of various MySql databases and saves a copy to
> that second hard drive.
>
> For added security, I'd love to have a cron job (on my home Ubuntu
> machine) that runs each night and downloads all the backups to my home
> machine. I thought I could write a bash shell script using scp to do
> this, but I now find out that one has to jump through several hoops
> (create private/public keys, etc) to do it.
>
> I'm wondering if there is an easier way to download the files, using
> PHP? Any thoughts on this?


What is your company's policy concerning corporate data security?


  Réponse avec citation
Vieux 10/02/2008, 05h07   #3
ZeldorBlat
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to ssh or scp or sftp through PHP?

On Feb 9, 10:25 pm, lawrence k <lkrub...@geocities.com> wrote:
> On the company's webserver we have two harddrives. Apache is aware of
> one of those harddrives and serves websites from that harddrive. The
> other harddrive is not reachable via the web. I've written some cron
> jobs that make a backup of various MySql databases and saves a copy to
> that second hard drive.
>
> For added security, I'd love to have a cron job (on my home Ubuntu
> machine) that runs each night and downloads all the backups to my home
> machine. I thought I could write a bash shell script using scp to do
> this, but I now find out that one has to jump through several hoops
> (create private/public keys, etc) to do it.
>
> I'm wondering if there is an easier way to download the files, using
> PHP? Any thoughts on this?


It really isn't that hard to set up ssh and scp to not require a
password. Probably a lot less trouble than trying to do it in PHP.
Google for "ssh no password" and you'll find plenty of information.
  Réponse avec citation
Vieux 11/02/2008, 13h47   #4
Toby A Inkster
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to ssh or scp or sftp through PHP?

lawrence k wrote:

> but I now find out that one has to jump through several hoops (create
> private/public keys, etc) to do it.


This is actually really easy to do.

On the client end, you run "ssh-keygen" which creates two files:

~/.ssh/id_dsa (think of this as an identity badge)
~/.ssh/id_dsa.pub (think of this as verification for the badge)

For any servers into which you wish to be able to log without a password,
you copy the "id_dsa.pub" file to that server and append it to the end of
the file "~/.ssh/authorized_keys2", which can be done from the command
like using:

cat id_dsa.pub >>~/.ssh/authorized_keys2

The "authorized_keys2" file can be thought of as a database of which
badges have authorised access to the server.

Your first go might take 20-30 minutes to figure it all out, but once you
get used to it, it only takes a few minutes to set up.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 12 days, 18:55.]

Mince & Dumplings
http://tobyinkster.co.uk/blog/2008/0...nce-dumplings/
  Réponse avec citation
Vieux 16/02/2008, 09h34   #5
lawrence k
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to ssh or scp or sftp through PHP?

On Feb 9, 10:35 pm, "McKirahan" <N...@McKirahan.com> wrote:
> "lawrence k" <lkrub...@geocities.com> wrote in message
>
> news:5b537a98-84ad-47fd-b1e4-2d1683b43572@v67g2000hse.googlegroups.com...
>
>
>
> > On the company's webserver we have two harddrives. Apache is aware of
> > one of those harddrives and serves websites from that harddrive. The
> > other harddrive is not reachable via the web. I've written some cron
> > jobs that make a backup of various MySql databases and saves a copy to
> > that second hard drive.

>
> > For added security, I'd love to have a cron job (on my home Ubuntu
> > machine) that runs each night and downloads all the backups to my home
> > machine. I thought I could write a bash shell script using scp to do
> > this, but I now find out that one has to jump through several hoops
> > (create private/public keys, etc) to do it.

>
> > I'm wondering if there is an easier way to download the files, using
> > PHP? Any thoughts on this?

>
> What is your company's policy concerning corporate data security?



I'm allowed to download the files, if that is what you need. I'm one
of the owners of the firm, and I'm the one who does most of the
sysadmin stuff (though I'm not really a sysadmin, obviously). So I'm
allowed to do it, so long as I can figure out a secure way to do it.

  Réponse avec citation
Vieux 16/02/2008, 09h35   #6
lawrence k
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: how to ssh or scp or sftp through PHP?

On Feb 11, 7:47 am, Toby A Inkster <usenet200...@tobyinkster.co.uk>
wrote:
> lawrence k wrote:
> > but I now find out that one has to jump through several hoops (create
> > private/public keys, etc) to do it.

>
> This is actually really easy to do.
>
> On the client end, you run "ssh-keygen" which creates two files:
>
> ~/.ssh/id_dsa (think of this as an identity badge)
> ~/.ssh/id_dsa.pub (think of this as verification for the badge)
>
> For any servers into which you wish to be able to log without a password,
> you copy the "id_dsa.pub" file to that server and append it to the end of
> the file "~/.ssh/authorized_keys2", which can be done from the command
> like using:
>
> cat id_dsa.pub >>~/.ssh/authorized_keys2
>
> The "authorized_keys2" file can be thought of as a database of which
> badges have authorised access to the server.
>
> Your first go might take 20-30 minutes to figure it all out, but once you
> get used to it, it only takes a few minutes to set up.



Okay, you convinced me. I was being lazy. But I'll get it together and
do this.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 12h53.


Édité par : vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,36592 seconds with 14 queries