Browse Source

ssh_key: create parent directory of 'authorized_keys' file

Unknwon 8 years ago
parent
commit
de2d3e3fd8
1 changed files with 1 additions and 0 deletions
  1. 1 0
      models/ssh_key.go

+ 1 - 0
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)