Bug 3156 - Prevent ~/.ssh creation
Summary: Prevent ~/.ssh creation
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 8.2p1
Hardware: amd64 Linux
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_8_4
  Show dependency treegraph
 
Reported: 2020-04-30 05:56 AEST by alexandreprovencio
Modified: 2020-10-02 14:55 AEST (History)
3 users (show)

See Also:


Attachments
create ~/.ssh on demand (2.64 KB, patch)
2020-05-29 16:39 AEST, Darren Tucker
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description alexandreprovencio 2020-04-30 05:56:44 AEST
Hello Guys,
on my use case, i really don't need anything that is created on `~/.ssh`, except for the `known_hosts` file.

I like the way the XDG specification works, so I tried changing the value of UserKnownHostsFile to something like `~/.cache/known_hosts` which works fine, but ssh still creates an empty `~/.ssh`.

Can it be avoided or is it really hardcoded?
Comment 1 Damien Miller 2020-05-08 13:57:14 AEST
There is no way at present. Since ssh assumes pretty deeply that ~/.ssh exists, to implement this properly would require that ssh search its configuration for anything that may write to that directory before it stopped doing so.
Comment 2 Darren Tucker 2020-05-29 15:19:17 AEST
(In reply to Damien Miller from comment #1)
> There is no way at present. Since ssh assumes pretty deeply that
> ~/.ssh exists

Most of the uses I can think of are on the server side, and most of those (and the client for that matter) are read-only.  I'll try moving it and see what breaks.
Comment 3 Darren Tucker 2020-05-29 16:39:30 AEST
Created attachment 3402 [details]
create ~/.ssh on demand

~/.ssh/known_hosts is the only thing I could find.

ssh-keygen does its own thing which looks more or less ok.
Comment 4 Darren Tucker 2020-06-26 15:04:07 AEST
The patch has been applied and will be in the next major release.  Thanks for the report.
Comment 5 alexandreprovencio 2020-06-27 04:43:32 AEST
That's great!
Thank you lots for your time :)
Comment 6 Darren Tucker 2020-10-02 14:55:06 AEST
Mass close of all bugs fixed in 8.4 release.