From de2d3e3fd8d8e0ecbf420b94d58cc3e78af2aa72 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 8 Mar 2017 22:08:31 -0500 Subject: [PATCH] ssh_key: create parent directory of 'authorized_keys' file --- models/ssh_key.go | 1 + 1 file changed, 1 insertion(+) diff --git a/models/ssh_key.go b/models/ssh_key.go index 387fc0169..aedf42b90 100644 --- a/models/ssh_key.go +++ b/models/ssh_key.go @@ -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)