Ensure .ssh directory exists before creating SSH identity file
This commit is contained in:
@@ -82,6 +82,12 @@ local function createSSHKeyFilesFromEnv()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Ensure .ssh directory exists
|
||||||
|
local ssh_dir = SSH_IDENTITY_FILE:match("^(.*)/[^/]+$
|
||||||
|
if ssh_dir then
|
||||||
|
os.execute(("mkdir -p %q && chmod 700 %q"):format(ssh_dir, ssh_dir))
|
||||||
|
end
|
||||||
|
|
||||||
local priv_fh = io.open(SSH_IDENTITY_FILE, "w")
|
local priv_fh = io.open(SSH_IDENTITY_FILE, "w")
|
||||||
if not priv_fh then
|
if not priv_fh then
|
||||||
log("Failed to open SSH identity file for writing: " .. SSH_IDENTITY_FILE)
|
log("Failed to open SSH identity file for writing: " .. SSH_IDENTITY_FILE)
|
||||||
|
|||||||
Reference in New Issue
Block a user