ssh_key: create parent directory of 'authorized_keys' file

This commit is contained in:
Unknwon 2017-03-08 22:08:31 -05:00
parent 295d251232
commit de2d3e3fd8
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3

View File

@ -527,6 +527,7 @@ func RewriteAllPublicKeys() error {
sshOpLocker.Lock()
defer sshOpLocker.Unlock()
os.MkdirAll(setting.SSH.RootPath, os.ModePerm)
fpath := filepath.Join(setting.SSH.RootPath, "authorized_keys")
tmpPath := fpath + ".tmp"
f, err := os.OpenFile(tmpPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)