[PATCH] ssh: ensure ~/.ssh exists

Tuncer Ayaz tuncer.ayaz@REDACTED
Fri Sep 3 13:05:46 CEST 2010


On Fri, Sep 3, 2010 at 12:52 PM, Tuncer Ayaz wrote:
> Make sure that ~/.ssh exists before trying to open files like
> ~/.ssh/known_hosts.
>
> Reported-By: Daniel Goertzen
> ---
>  lib/ssh/src/ssh_file.erl |   18 ++++++++++++++++--
>  1 files changed, 16 insertions(+), 2 deletions(-)

[...]

Please review this patch instead. This one makes sure that correct
access permissions are set. Thanks to Hakan Mattson catching that.

The rationale for the patch is that OpenSSH and friends do create
~/.ssh first before trying to write to ~/.ssh/known_hosts.

This reminds me that we need variants of make_dir/1 and ensure_dir/1
which allow one to specify the access permissions. It's a common use
case and given support from the underlying operating system one could
try to make it an atomic operation.


More information about the erlang-patches mailing list