[PATCH] ssh: ensure ~/.ssh exists
Tuncer Ayaz
tuncer.ayaz@REDACTED
Wed Sep 22 12:10:16 CEST 2010
On Wed, Sep 22, 2010 at 12:03 PM, Tuncer Ayaz wrote:
> +-define(PERM_700, 8#700).
> +-define(PERM_644, 8#644).
Only change to previous patch is that I removed the
zero-padding from the file modes.
> %% API
> public_host_dsa_key(Type, Opts) ->
> File = file_name(Type, "ssh_host_dsa_key.pub", Opts),
> @@ -113,8 +118,10 @@ do_lookup_host_key(Host, Alg, Opts) ->
>
> add_host_key(Host, Key, Opts) ->
> Host1 = add_ip(replace_localhost(Host)),
> - case file:open(file_name(user, "known_hosts", Opts),[write,append]) of
> + KnownHosts = file_name(user, "known_hosts", Opts),
> + case file:open(KnownHosts, [write,append]) of
> {ok, Fd} ->
> + ok = chmod(KnownHosts, ?PERM_644),
Let's not forget that I'm not sure that explicitly setting
~/.ssh/known_hosts's file mode to 644 is needed at all.
More information about the erlang-patches
mailing list