如何在ssh2_connect登录中设置无密码?

时间:2019-04-15 04:28:42

标签: php ubuntu authentication ssh ssh2

我遍历了可以不提供密码即可进行ssh的帖子[https://askubuntu.com/a/296574/905016] 但是我想通过php中的ssh2_connect登录,在此我需要提供密码详细信息。 这是示例:

<?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);

如何使它的密码比上面链接中的ssh少。 我想通过ssh2_connect登录到服务器而没有密码。

0 个答案:

没有答案