Skip to content
Snippets Groups Projects
Unverified Commit 10d49bf6 authored by Kevin Lyda's avatar Kevin Lyda
Browse files

Create the ssh dir if it's missing

parent eedcd992
Branches
Tags
No related merge requests found
......@@ -20,7 +20,12 @@ func Add(login, public string) error {
keyline := fmt.Sprintf(keytemplate, bulletin, login, public)
keyfile := path.Join(xdg.Home, ".ssh", "authorized_keys")
sshdir := path.Join(xdg.Home, ".ssh")
err = os.MkdirAll(sshdir, 0700)
if err != nil {
return err
}
keyfile := path.Join(sshdir, "authorized_keys")
f, err := os.OpenFile(keyfile, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment