mirror of https://github.com/docker/docs.git
Merge pull request #990 from ehazlett/ssh-key-win
fix ssh key gen bug windows
This commit is contained in:
commit
0c64d0538f
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
gossh "golang.org/x/crypto/ssh"
|
gossh "golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
|
|
@ -79,8 +80,12 @@ func (kp *KeyPair) WriteToFile(privateKeyPath string, publicKeyPath string) erro
|
||||||
return ErrUnableToWriteFile
|
return ErrUnableToWriteFile
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := f.Chmod(0600); err != nil {
|
// windows does not support chmod
|
||||||
return err
|
switch runtime.GOOS {
|
||||||
|
case "darwin", "linux":
|
||||||
|
if err := f.Chmod(0600); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue