PHP Classes

PHP SSH Connection Session: Run arbitrary length commands in a server with SSH

Recommend this page to a friend!
  Info   View files Documentation   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-10-21 (7 days ago) RSS 2.0 feedStarStarStarStar 79%Total: 389 All time: 6,617 This week: 238Up
Version License PHP version Categories
ssh-session 1.0.9GNU General Publi...5.5Networking, PHP 5, Files and Folders
Description Author

This package can run arbitrary length commands in a server with SSH.

It can connect to a given ssh server and execute given commands.

If the commands exceed the maximum length, it write the commands to a file and executes it from there using the bash shell.

It can also execute file manipulation functions like uploading and downloading files, creating directories, changing file permissions, renaming files, reading or writing remote file contents, etc..

Innovation Award
PHP Programming Innovation award winner
August 2016
Winner


Prize: One downloadable e-book of choice by O'Reilly
SSH is a protocol to communicate with a remote server via a secure connection that allows to execute commands on a remote machine.

However, the length of the commands that can be executed is limited.

This package provides a workaround for this limitation that consists in creating a shell script to execute long commands and execute it using the bash shell.

Manuel Lemos
Picture of Christian Vigh
  Performance   Level  
Name: Christian Vigh <contact>
Classes: 32 packages by
Country: France France
Innovation award
Innovation award
Nominee: 20x

Winner: 3x

Details

HOW TO RUN THE EXAMPLES ?

You have to edit the file example.inc.php ; it contains variables that you MUST set to your own configuration needs before running the examples :

  • $host : Host name or IP address of your remote server.
  • port : Port number of the sshd server on your remote system (usually, 22).
  • $user : the user you want to connect to on your remote system.
  • $password : User password (set this variable if you want to run the example.password.php script, which uses password-based authentication)
  • $private\_key\_file, $public\_key\_file : Paths to the files containing your private and public ssh keys (set these variables if you want to run the example.key.php script, which uses ssh key-based authentication)

PREREQUISITES

  • Your remote system MUST be a Unix system for the examples to run as is
  • If you used puttygen to generate your public and private keys, you have to know that the key that is labelled :

    Public key for pasting into OpenSSH authorized_keys file

will not have the correct format for using it as a public key on Unix systems. You will have to go to the Conversions menu and chose the "Export OpenSSH key" option.

  • On your remote Unix system, you must add your public key in the .ssh/authorized_keys file of your remote user
  • And, of course, you must have an sshd server up and running on your remote system !
  Files folder image Files  
File Role Description
Plain text file Authentication.phpclass Class Class source
Plain text file Connection.phpclass Class Class source
Accessible without login Plain text file example.inc.php Conf. Configuration script
Accessible without login Plain text file example.key.php Example Example script
Accessible without login Plain text file example.password.php Example Example script
Plain text file FileSystem.phpclass Class Class source
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file NOTICE Data Auxiliary data
Accessible without login Plain text file README.examples.md Doc. Documentation
Accessible without login Plain text file README.md Doc. Documentation
Plain text file Session.phpclass Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:389
This week:0
All time:6,617
This week:238Up
User Ratings User Comments (1)
 All time
Utility:100%StarStarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:95%StarStarStarStarStar
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:79%StarStarStarStar
Rank:31
 
nice
6 years ago (muabshir)
80%StarStarStarStarStar
 
For more information send a message to info at phpclasses dot org.