Skip to content

Commit 78ae9ff

Browse files
committed
should prepare authorizedkeys if not exist
1 parent 0ac0d4b commit 78ae9ff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/job_ssh.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ func (m ModJobSshStruct) setupThisNode(pubkey string) {
122122
os.MkdirAll(authorizedKeysDirPath, 0755)
123123
}
124124

125+
// prepare authorized_keys file
126+
if _, err := os.Stat(authorizedKeysPath); os.IsNotExist(err) {
127+
// os.Create(authorizedKeysPath)
128+
os.WriteFile(authorizedKeysPath, []byte(""), 0644)
129+
}
130+
125131
// 读取现有的 authorized_keys 文件内容
126132
existingKeys, err := ioutil.ReadFile(authorizedKeysPath)
127133
if err != nil {

0 commit comments

Comments
 (0)