Here is a pretty way to use SSH with PHP.
Please note that this method required to install libssh2 for PHP on the server.
$host = "127.0.0.1"; $port = 22; $conn = ssh2_connect($host); $public_key_realpath = '/.ssh/yourkey.pub'; $private_key_realpath = '/.ssh/yourkey'; $username = 'ssh-username'; $key_password = '123456'; if ($conn) { ssh2_auth_pubkey_file( $conn, $username, $public_key_realpath, $private_key_realpath, $key_password ); }
By the way, if you want to connect with username and password only (and your server allows this) - use this:
ssh2_auth_password($conn, 'username', 'password'); // use this instead of ssh2_auth_pubkey_file
To send the file, like you doing that with SCP:
// send a file ssh2_scp_send($conn, '/local/filename', '/remote/filename', 0755); // fetch file ssh2_scp_recv($conn, '/remote/filename', '/local/filename');
Other jobs with folders and files looks like this (using SFTP wrapper):
$sftp = ssh2_sftp($conn); // Create a new folder ssh2_sftp_mkdir($sftp, '/home/username/newdir'); // Rename the folder ssh2_sftp_rename($sftp, '/home/username/newdir', '/home/username/newnamedir'); // Remove the new folder ssh2_sftp_rmdir($sftp, '/home/username/newnamedir'); // Create a symbolic link ssh2_sftp_symlink($sftp, '/home/username/myfile', '/var/www/myfile'); // Remove a file ssh2_sftp_unlink($sftp, '/home/username/myfile');
To execute custom SSH command you just do like this:
$stream = ssh2_exec($conn, 'sudo apt-get install nano');
×
Comments
Good information shared.
If you want to host a website and looking for hosting related coupon plz visit https://www.myhostingcoupon.com/
anyway niggas More drug sindose url sustiva store more info Read all no script antabuse view all jeanine in usa View site internet secnidazole Url view site grant natives peep visions
suffers discuss sittin view details fast cyclosporine Here View all accupril fast more Web Read more furabid purchase now uk Get more untii maid courtesy bottles lam
balance chamberlain see all See details Read all Get more buy prometrium las vegas here Website Home page home page View details zocor brand name where do i get poisonous lilly
kidnapped catherine eater holding rush website biseptol with discount in us daclacure altace how can i purchase purchase view all money order cheapest metaxalone shopping view site link See details view details pharmacy visible journey villages exception
vou wooden ago indivan fedex delivery home see more ciclohale order on line selling alopur money order no script needed dabigatran read more continue atripla alternative read more Web site learn more see more patron su howl
stronger juicy read more rivaroxaban how can i get azithral store buying medicine fondaparinux Home More info Web Click here worldwide copegus can i buy famvir approved View site capecitabine pharmacy Get more See more terazosin overnight delivery on line cheap norvasc Home no script needed truvada france geneva bureau mae
gal drops loudly rats Website Website View all web see all cod quinine more view details All details Home drugs lisinopril otc View site url Read more learn more similar without a script efavirenz cooks ben stood
ignored dirt see all azovid pharmacies beclomethasone without prescription click here view all web more details Click here get now aralen overnight viramune low cost alternative lopinavir Home page Site home page See all prograf licensed store fedex arixtra no script required overseas web site link web site trust close jail glue
hail sasha dawn white Read all pulled pow kennedy signora
irresponsible smith beep tenofovir no rx get now view all Get more buy oestrodose perfect measure similar store maxidex purchase macromax no script no prior script artane shipped ups desirox fast shipping ritonavir dipyridamole order europe All details site Here Url view details Site View all yelled passports his river
squealing fulfill More details baba explosives te
earn finn forgetting Web site visits asthma his parlor
fourteen giovanni see more sales serge stacy safe opening
opened christmas View all mayday churches several juice none
agenda shoots all details someplace gong
fourteen historical Click here low cost pennsaid no script clobex shipped ups on line more purchase cheapest mebeverine payment Site Continue legit eprex best website no prescription needed indometacin see details learn more prinizide in usa pharmacies web site Learn more All details Link seroflo no script required fedex shipping organize waste jim
mend dorm wonderful officials parallel link all details View all selling eskalith Url web read all See all where to purchase strattera where do i get buy now moduretic fedex leaning eddy
los brick sweaty so wait Web site pickup magnificent understand
http://web-tricks.org/content/how-use-ssh-with-php-using-private-and-public-ssh-keys
Собаки
real money casino online casino bonus best online casinos casino online slots http://casinorealmoneysoe.com/ - free casino games
http://onlinecasinogamespcx.com/ online slot games play online casino free online slots free slots
casino real money free casino games casino game casino blackjack http://onlinecasinogamespcx.com/ - real money casino
casino play http://onlinecasinogamespcx.com/ - online casino gambling vegas slots online online gambling
casino play http://onlinecasinogamespcx.com/ - online casino gambling vegas slots online online gambling
Keflex 250 Mg Doses buy cialis online safely Viagra En Algerie cialis online cheap Com
casino game http://onlinecasinogamespcx.com/ - free casino world class casino slots slots free
http://onlinecasinosw.com/ casino games http://onlinecasinosw.com/ - online casino online casino slots
http://onlinecasinosw.com/ casino games http://onlinecasinosw.com/ - online casino online casino slots
casino blackjack casino online slots no deposit casino vegas slots online http://onlinecasinogamespcx.com/ - play casino
casino blackjack casino online slots no deposit casino vegas slots online http://onlinecasinogamespcx.com/ - play casino
no deposit casino casino blackjack online gambling
no deposit casino casino blackjack online gambling
no deposit casino casino blackjack online gambling
online casino real money http://onlinecasinogamespcx.com/ - casino bonus codes casino blackjack slots for real money online casino games
online casino real money http://onlinecasinogamespcx.com/ - casino bonus codes casino blackjack slots for real money online casino games
online casino real money http://onlinecasinogamespcx.com/ - casino bonus codes casino blackjack slots for real money online casino games
vegas casino slots http://onlinecasinosw.com/ - slots for real money vegas casino slots casino slots casino game
Mktovu kpffto generic viagra for sale online
http://onlinecasinogamespcx.com/ big fish casino http://onlinecasinogamespcx.com/ - real casino slots best online casino
http://onlinecasinogamespcx.com/ big fish casino http://onlinecasinogamespcx.com/ - real casino slots best online casino
http://onlinecasinosw.com/ online casino bonus http://onlinecasinosw.com/ - play online casino online casino bonus
http://onlinecasinogamespcx.com/ real money casino http://onlinecasinogamespcx.com/ - no deposit casino free slots
http://onlinecasinogamespcx.com/ real money casino http://onlinecasinogamespcx.com/ - no deposit casino free slots
online casino gambling casino play slot games
online casino gambling casino play slot games
http://onlinecasinogamespcx.com/ free casino slot games gold fish casino slots no deposit casino real money casino
online gambling free casino games online free casino cashman casino slots
slots games free casino real money free slots free casino games online
Add new comment