ERLEDIGT
JA
JA
ANTWORTEN
11
11
ZUGRIFFE
8879
8879
EMPFEHLEN
-
Hallo
Wie kann ich eine SSH Verbindung vom Server A nach Server B herstellen und da Prozesse starten?
Das soll alles über eine PHP Seite laufen.
Damit ich auf der PHP Seite, Apache2 Start klicke und das Script mach das dann auotmatisch.
Es logt sich auf den Server B ein, geht und den entsprechenden Ortner ein ( Allso cd /etc/init.d/ ) und macht dann " ./apache2 start "
Damit ich nicht immer alles per hand machen muss und alles selber übers SSH.
Ich weiss dass man openssl-0.9.8b und libssh2-0.13 braucht.
Es fehlen mir noch die richtigen Befehle.
Ich hoffe es kann mir da einer weiter helfen.
MFG
-
Schau mal hier, da findest Du alles was Du brauchst.
Mal kurz der Ablauf:- Verbinden
ssh2_connect() - Anmelden
ssh2_auth_hostbased_file(), ssh2_auth_none(), ssh2_auth_password() oder ssh2_auth_pubkey_file()
Meist wird hier wohl ssh2_auth_password() zum Einsatz kommen. - Programme ausfuehren
ssh2_exec() - Verbindung beenden
fclose()
PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
__________________
EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
__________________
__________________Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
Zitat von Friedrich Nietzsche
- Verbinden
-
Hi
Die seite känne ich schon und alle scripte die ich damit gecodet habe gingen nicht.
das script konnte dich conekten aber beim einlogen ist es gescheitert.
Kannst du mir bitte ein fertiges code geben.
Am besten damit es z.B.: so ist.
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
ssh2_connect($ip, $port) <?php ip= 127.0.0.1 port=22 user=sshuser pw=sshpw $connection = ssh2_connect('$ip', $port); ssh2_auth_password($connection, '$user', '$pw'); $stream = ssh2_exec($connection, 'cd /programm/'); $stream = ssh2_exec($connection, './programm start/'); fclose($stream) ?>
Habe das etwa so da gesehen und benutzt aber ist bestimmt falsch.
Will es mit user und pw eingabe haben und nicht mit public_kay oder wie das genau heist.
Ich versuche es schon ca. 1 woche, ok habe auch was anderes versucht aber hatt auch was damit zu tun.
Ich würde mich sehr freun wenn wir da entlich mal einer helfen kann, so das es auch geht.
PS: komme mit dem public_kay ( oder wie das genau heist ) nicht klar, da ich noch keine gute anleitung dazu gefunden habe wie ich den kay erstehle und den dann mein code benutze.Geändert von deinpapa (20.05.06 um 17:59 Uhr)
-
Also bei dem Script duerftest Du erstmal einen Fehler bekommen, dass ein PHP-Befehl ausserhalb des als PHP ausgewiesenen Bereiches steht.
Weiterhin duerfte es Fehler geben da Du versuchst Konstanten mittels = und nicht ueber define() zu setzen.
Und zusaetzlich hast Du Variablen in '' gesetzt, was dafuer sorgt, dass das ganze als String gehandhabt wird.
Probier das mal:
Code php:1 2 3 4 5 6 7
$sshhostname=''; $sshusername=''; $sshpassword=''; $ssh=ssh2_connect($sshhostname); ssh2_auth_password($ssh,$sshusername,$sshpassword); ssh2_exec($ssh,'logout'); fclose($ssh);
PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
__________________
EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
__________________
__________________Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
Zitat von Friedrich Nietzsche
-
Hallo
Konnte dein code noch nicht testen da ich ja OpenSSL, libssh2 und PECL/ssh2 brauche.
OpenSSL und libssh2 habe ich installiert aber wenn ich PECL/ssh2 installieren will muss ich den befehl benutzen ( laut http://de.php.net/manual/de/ref.ssh2.php ) " pear install ssh2 "
Aber ich krige da das?
Code :1 2 3 4 5 6 7 8
local:/opt/ssh2-0.10 # pear install ssh2 downloading ssh2-0.10.tgz ... ...done: 22,187 bytes 5 source files, building running: phpize sh: line 1: phpize: command not found `phpize' failed local:/opt/ssh2-0.10 #
Und wenn ich den befehl benutze " phpize && ./configure --with-ssh2 && make to generate ssh2.so " kommt das:
Code :1 2 3
local:/opt/ssh2-0.10 # phpize && ./configure --with-ssh2 && make to generate ssh2.so -bash: phpize: command not found local:/opt/ssh2-0.10 #
Ich habe schon mit YAST versucht paar programme zu installieren aber dann kamm eine andere fehlermeldung.
Unswar die hier:
Code :1 2 3
local:/opt/ssh2-0.10 # phpize && ./configure --with-ssh2 && make /usr/bin/phpize: line 55: aclocal: command not found local:/opt/ssh2-0.10 #
Ich krige die jetzt nicht da ich den server wider neuistalliert habe, jetzt krige ich wider die mit " command not found ".
Kann mir da einer weiter helfen ?
Was muss ich dafür einstehlen oder installieren?
Und wo krige ich die sachen?
-
Dir fehlt jetzt aclocal. Ich bin nicht ganz sicher, aber ich mein das gehoert zu autoconf.
PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
__________________
EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
__________________
__________________Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
Zitat von Friedrich Nietzsche
-
wo kann ich das runter laden und wo gibt eine anleitung wie ich das installiere und einrichte?
Habe schon mal was davon gelesen und danach gegoogelt aber nur forum beitrege gefunden und nichts war mir weiter geholfen hat.
-
Wenn Du das nicht ueber den Yast installieren kannst dann kannst Du es unter ftp://ftp.gnu.org/gnu/autoconf bekommen.
Ich hoff nur der Rechner an dem Du da rumspielst steht bei Dir daheim und ist kein Root-Server.
PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
__________________
EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
__________________
__________________Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
Zitat von Friedrich Nietzsche
-
danke
Aber weist du wie ich den fehler weg krige ?
Code :1 2 3
local:/opt/ssh2-0.10 # phpize && ./configure --with-ssh2 && make to generate ssh2.so -bash: phpize: command not found local:/opt/ssh2-0.10 #
Ich habe mal was davon gelesen das man php4 developer paket und zlib developer installieren muss damit es geht. Aber bei yast finde ich die nicht nur mod_php4-devel und zlib-devel. und zlib-devel ist installiert nur das andere nicht.
Kannst da weiter helfen ?
#EDIT#
Habe autoconf. installiert. allso über yast habe es noch da gefunden
#/EDIT\#Geändert von deinpapa (21.05.06 um 15:05 Uhr)
-
Keine Ahnung in welchem Paket Suse sowas versteckt. Mit Suse hab ich seit Jahren nichts mehr am Hut.
Ich wuerde Dir das PHP das Suse Dir liefert zu entfernen und einfach die aktuelle Version aus den Sourcen zu installieren.PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
__________________
EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
__________________
__________________Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
Zitat von Friedrich Nietzsche
-
jucho es geht, es geht :-D
Entlich.
Muss mir jetzt erst mal eine anleitung schreiben wenn ich mal wider probleme habe oder jemand anderes.
Werde erst mal jetzt alles fertig machen, dann den code von dir testen und dann die anleitung schreiben.
Noch mals danke. ( habe jetzt wider mal was dazu gelernt )
Hoffe der rest geht auch.
-
hi
Ich bins mal wider.
Allso, ich habe alles installiert aber der code gieng nicht.
Es komm keine fehler meldung, garnichts es hat nur geladen geladen und geladen.
Dann habe ich ein anderen code verwendet ( von mir wo der conektet hat aber nicht einlogen konnte ) und da war das gleich er hat nur geladen.
Habe mich dann per ssh eingelogt und habe versucht per hand eine verbindung herzustehlen, aber kamm fehler.
Habe mich alls root eingelogt und habe ider versucht eine ssh verbindung zu einem anderem server herzustellen und es ging.
( Habe SuSE Linux Professional 9.0 inkl Confixx 3.0 verwendet, hatte es neu drauf installiert. )
Jabe dann alles formatirt und mein alltes system wider installiert und es da versucht.
Und hatte schwirich keiten ( meine anleitung hat nicht funktionirt ) Habe dann einiges versucht und etwas weiter gekommen nur jetzt hänge ich hier:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
local:/opt/ssh2-0.10 # phpize && ./configure --with-ssh2 && make to generate ssh2.so Configuring for: PHP Api Version: 20020918 Zend Module Api No: 20020429 Zend Extension Api No: 20021010 checking build system type... i686-suse-linux checking host system type... i686-suse-linux checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking whether gcc and cc understand -c and -o together... yes checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/Zend -I/usr/include/php/TSRM checking for PHP extension directory... /usr/lib/php/extensions checking for re2c... exit 0; checking for gawk... gawk checking for ssh2 support... yes, shared checking for ssh2 files in default path... found in /usr checking for libssh2_banner_set in -lssh2... yes checking for libssh2_channel_forward_listen_ex in -lssh2... yes checking for libssh2_userauth_hostbased_fromfile_ex in -lssh2... yes checking for libssh2_poll in -lssh2... yes checking for libssh2_publickey_init in -lssh2... yes checking for a sed that does not truncate output... /usr/bin/sed checking for egrep... grep -E checking for ld used by gcc... /usr/i586-suse-linux/bin/ld checking if the linker (/usr/i586-suse-linux/bin/ld) is GNU ld... yes checking for /usr/i586-suse-linux/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking whether ln -s works... yes checking how to recognise dependent libraries... pass_all checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking for g++... no checking for c++... no checking for gpp... no checking for aCC... no checking for CC... no checking for cxx... no checking for cc++... no checking for cl... no checking for FCC... no checking for KCC... no checking for RCC... no checking for xlC_r... no checking for xlC... no checking whether we are using the GNU C++ compiler... no checking whether g++ accepts -g... no checking for g77... no checking for f77... no checking for xlf... no checking for frt... no checking for pgf77... no checking for fort77... no checking for fl32... no checking for af77... no checking for f90... no checking for xlf90... no checking for pgf90... no checking for epcf90... no checking for f95... no checking for fort... no checking for xlf95... no checking for ifc... no checking for efc... no checking for pgf95... no checking for lf95... no checking for gfortran... no checking whether we are using the GNU Fortran 77 compiler... no checking whether accepts -g... no checking the maximum length of command line arguments... 32768 checking command to parse /usr/bin/nm -B output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc static flag works... yes checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/i586-suse-linux/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... cat: /etc/ld.so.conf.d/*.conf: No such file or directory GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no configure: creating libtool appending configuration tag "CXX" to libtool appending configuration tag "F77" to libtool configure: creating ./config.status config.status: creating config.h make: *** No rule to make target `to'. Stop. local:/opt/ssh2-0.10 #
Wie kann ich die sachen die mit " no " sind hinzufügen ? ( allso was muss ich installieren oder einstellen )
Und was kann ich machen damit es geht ?
(Bald komme ich in die klapse, bin schon ganz durcheinander wegen dem ganzen)
Hoffe ihr könnt mir mal wider helfen.
Ähnliche Themen
-
Grafik auf dem Server erstellen (Server ohne Grafikkarte)
Von Polli im Forum Swing, Java2D/3D, SWT, JFaceAntworten: 24Letzter Beitrag: 28.11.08, 15:43 -
Datei nach Erstellung auf dem Server 1 autom. zum Server 2 senden
Von julia29 im Forum PHPAntworten: 2Letzter Beitrag: 24.12.07, 16:12 -
Server lässt nach Abbruch der WLAN Verbindung keine Verbindung mehr zu!
Von VanNameless im Forum .NET Web und KommunikationAntworten: 1Letzter Beitrag: 08.10.07, 20:42 -
Verbindung zu Server erstellen über Winsock
Von AK_ich im Forum Visual Basic 6.0Antworten: 2Letzter Beitrag: 09.07.07, 08:50 -
asp soll nach trennung der verbindung auf server weiter laufen
Von blacksb im Forum ASPAntworten: 0Letzter Beitrag: 16.03.04, 16:22





Zitieren
Login






[PHP][Snippet] Array zu XML konvertieren