|
|
|
@ -14,6 +14,7 @@ import (
|
|
|
|
|
"os/exec" |
|
|
|
|
"path" |
|
|
|
|
"path/filepath" |
|
|
|
|
"runtime" |
|
|
|
|
"strings" |
|
|
|
|
"sync" |
|
|
|
|
"time" |
|
|
|
@ -160,12 +161,16 @@ func saveAuthorizedKeyFile(key *PublicKey) error {
|
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// FIXME: following command does not support in Windows.
|
|
|
|
|
if runtime.GOOS != "windows" { |
|
|
|
|
if finfo.Mode().Perm() > 0600 { |
|
|
|
|
log.Error(4, "authorized_keys file has unusual permission flags: %s - setting to -rw-------", finfo.Mode().Perm().String()) |
|
|
|
|
if err = f.Chmod(0600); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_, err = f.WriteString(key.GetAuthorizedString()) |
|
|
|
|
return err |
|
|
|
|