Why can't I create a .ssh directory on macOS 10.15.4?

I'm running into a strange problem trying to set up ssh. I'm more used to Linux than macOS. Can someone explain to me what's going on here?

user@nothing ~ % mkdir ~/.ssh
mkdir: /Users/user: No such file or directory
user@nothing ~ % ls -ld ~
drwxr-xr-x+ 27 user  staff  864 Apr  1 13:49 /Users/user
user@nothing ~ % ls -ld ~/.ssh
ls: /Users/user/.ssh: No such file or directory

The ACLs are defined as:

nnyby@nothing ~ % ls -ael ~
total 96
drwxr-xr-x+ 26 nnyby  staff    832 Apr  2 09:47 .
 0: group:everyone deny delete
drwxr-xr-x   6 root   admin    192 Oct 23 20:37 ..
-r--------   1 nnyby  staff      7 Mar 28 11:24 .CFUserTextEncoding
-rw-r--r--@  1 nnyby  staff   6148 Apr  1 13:44 .DS_Store
drwx------  10 nnyby  staff    320 Apr  1 13:44 .Trash
-rw-------   1 nnyby  staff    751 Apr  1 13:43 .bash_history
drwx------  41 nnyby  staff   1312 Nov  7 14:29 .bash_sessions
drwx------   3 nnyby  staff     96 Nov 15 11:40 .config
drwxr-xr-x   4 nnyby  staff    128 Nov  1 11:27 .emacs.d
-rw-r--r--   1 nnyby  staff     53 Nov 13 12:28 .gitconfig
drwx------   3 nnyby  staff     96 Nov 15 11:40 .local
-rw-------   1 nnyby  staff    118 Mar 22 09:59 .python_history
-rw-------   1 nnyby  staff  12554 Apr  1 19:37 .viminfo
-rw-------   1 nnyby  staff   5271 Apr  2 09:21 .zsh_history
drwx------@  3 nnyby  staff     96 Apr  1 09:53 Applications
drwx------+ 14 nnyby  staff    448 Apr  1 22:56 Desktop
 0: group:everyone deny delete
drwx------+ 10 nnyby  staff    320 Apr  2 09:47 Documents
 0: group:everyone deny delete
drwx------@ 25 nnyby  staff    800 Apr  1 22:39 Downloads
 0: group:everyone deny delete
drwx------@ 66 nnyby  staff   2112 Apr  1 09:52 Library
 0: group:everyone deny delete
drwx------+  4 nnyby  staff    128 Nov 25 14:23 Movies
 0: group:everyone deny delete
drwx------+  4 nnyby  staff    128 Mar 17 20:50 Music
 0: group:everyone deny delete
drwx------+ 30 nnyby  staff    960 Apr  1 22:39 Pictures
 0: group:everyone deny delete
drwxr-xr-x+  4 nnyby  staff    128 Oct 24 14:34 Public
 0: group:everyone deny delete
drwxr-xr-x   4 nnyby  staff    128 Mar 20 10:40 dist
drwxr-xr-x   9 nnyby  staff    288 Apr  1 14:12 src
nnyby@nothing ~ % ls -ael ~/..
total 0
drwxr-xr-x   6 root      admin  192 Oct 23 20:37 .
drwxr-xr-x  22 root      admin  704 Mar 28 11:54 ..
-rw-r--r--   1 root      wheel    0 Oct 17 18:40 .localized
drwxrwxrwt   5 root      wheel  160 Oct 17 18:40 Shared
drwxr-xr-x+ 11 ctladmin  staff  352 Oct 24 14:34 ctladmin
 0: group:everyone deny delete
drwxr-xr-x+ 26 nnyby     staff  832 Apr  2 09:47 nnyby
 0: group:everyone deny delete

Similarly, I can't generate public and private keys:

user@nothing ~ % ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/user/.ssh/id_rsa): 
Could not create directory '/Users/user/.ssh': No such file or directory
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Saving key "/Users/user/.ssh/id_rsa" failed: No such file or directory

I can create a dot-prefixed directory with another name, no problem:

user@nothing ~ % mkdir ~/.abc
user@nothing ~ % 

If I do mkdir /tmp/.ssh; mv /tmp/.ssh ~/, the mv process hangs, and uses all my CPU until I restart!

So, how do I make my .ssh directory?


I booted into recovery mode, and ran First Aid on my disk. First the Macintosh HD volume, which returned without error.

Then, when I ran First Aid on the "Macintosh HD - Data" volume, the operation failed, with these errors:

First Aid run, pic 1

First Aid run, pic 2

I ran this operation twice, with the same errors. I didn't know what else to do, so I just restarted back into the normal environment.

When I log in, I see that there is a .ssh directory after all, created last October 25!

nnyby@nothing ~ % ls -lae .ssh
total 24
drwx------   5 nnyby  staff   160 Oct 25 11:36 .
drwxr-xr-x+ 26 nnyby  staff   832 Apr  2 12:43 ..
 0: group:everyone deny delete
-rw-------   1 nnyby  staff  1856 Oct 25 11:36 id_rsa
-rw-r--r--   1 nnyby  staff   423 Oct 25 11:36 id_rsa.pub
-rw-r--r--   1 nnyby  staff  3192 Apr  2 12:46 known_hosts

I had restarted this laptop plenty of times over the past few weeks, always with this .ssh problem, so maybe the disk repair did something to fix it? Either way, thank you macOS for being completely not frustrating at all to work with! I can't imagine why anyone would prefer to use Linux!