fix(ssh): start machine failed to start with exit status 255

Signed-off-by: Black-Hole1 <bh@bugs.cc>
This commit is contained in:
Black-Hole1 2023-06-16 18:53:08 +08:00
parent 0ada57fbb2
commit c2360800e0
No known key found for this signature in database
3 changed files with 6 additions and 1 deletions

View File

@ -573,6 +573,7 @@ func AppleHVSSH(username, identityPath, name string, sshPort int, inputArgs []st
port := strconv.Itoa(sshPort)
args := []string{"-i", identityPath, "-p", port, sshDestination,
"-o", "IdentitiesOnly=yes",
"-o", "StrictHostKeyChecking=no", "-o", "LogLevel=ERROR", "-o", "SetEnv=LC_ALL="}
if len(inputArgs) > 0 {
args = append(args, inputArgs...)

View File

@ -16,6 +16,7 @@ func CommonSSH(username, identityPath, name string, sshPort int, inputArgs []str
port := strconv.Itoa(sshPort)
args := []string{"-i", identityPath, "-p", port, sshDestination,
"-o", "IdentitiesOnly=yes",
"-o", "StrictHostKeyChecking=no", "-o", "LogLevel=ERROR", "-o", "SetEnv=LC_ALL="}
if len(inputArgs) > 0 {
args = append(args, inputArgs...)

View File

@ -1492,7 +1492,10 @@ func (v *MachineVM) SSH(name string, opts machine.SSHOptions) error {
sshDestination := username + "@localhost"
port := strconv.Itoa(v.Port)
args := []string{"-i", v.IdentityPath, "-p", port, sshDestination, "-o", "UserKnownHostsFile /dev/null", "-o", "StrictHostKeyChecking no"}
args := []string{"-i", v.IdentityPath, "-p", port, sshDestination,
"-o", "IdentitiesOnly yes",
"-o", "UserKnownHostsFile /dev/null",
"-o", "StrictHostKeyChecking no"}
if len(opts.Args) > 0 {
args = append(args, opts.Args...)
} else {