How can I set up password-less in ssh2_connect login?

51
April 15, 2019, at 11:50 AM

I have gone through the post where I can do ssh without giving password [https://askubuntu.com/a/296574/905016] But I want to login through ssh2_connect in php, where I need to give password detail. Here is sample:

<?php
$server   = "10.xx.xx.xx"; //IP of the server
$username = "xyz"; 
$password = "Password"; 
$command  = "bash hello.sh"; 
$connection = ssh2_connect($server, 22);
ssh2_auth_password($connection, $username, $password);
$stream = ssh2_exec($connection, $command);

How can I make it password less as in ssh in above link. I want to login to server through ssh2_connect without password.

READ ALSO
search nested array of objects and return full parents as results | javascript

search nested array of objects and return full parents as results | javascript

Hello I need a bit of help finishing up my functionI've successfully written a recursive function to loop through a nested object and find the results

46
Android GridLayout with dynamic number of columns per row

Android GridLayout with dynamic number of columns per row

I have cards with different width and I would like to create a Grid Layout where width = match the parent (filling the screen) and fixed heightI would like to set the cards in the Grid layout so the number of columns changes accordingly to the width of the elements...

19
I keep getting the error &ldquo;the string did not match the expected pattern&rdquo; for my fetch request

I keep getting the error “the string did not match the expected pattern” for my fetch request

I keep getting the error "the string did not match the expected pattern" for my fetch requestsI've seen some people having similar problems on here and other forums but can't pinpoint the problem

21