2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 17:46:38 +00:00

Merge pull request #3654 from cxhong/sshpass

using sshpass (if availble) connect to openbmc console
This commit is contained in:
zet809 2017-08-14 13:43:25 +08:00 committed by GitHub
commit f9cc8f71b9

View File

@ -91,7 +91,15 @@ if ($ENV{SSHCONSOLEPORT}) {
$sshport= $ENV{SSHCONSOLEPORT};
}
print "If the console cannot connect, please verify whether ssh keys has been configured on the bmc for $username user\n";
# To automatically connect to the console without the need to send over the ssh keys,
# ensure sshpass is installed on the Management and/or Service Nodes.
if (-x '/usr/bin/sshpass') {
exec "/usr/bin/sshpass -p $password ssh -p $sshport -l $username $bmcip";
} else {
# This will prompt the user to enter the password for the BMC
# if ssh keys are not sent and sshpass is not being used
exec "ssh -p $sshport -l $username $bmcip";
}
exec "ssh -p $sshport -l $username $bmcip";