Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

DominikHoffmann

macrumors 6502
Original poster
Jan 15, 2007
477
468
Indiana
In the past, I have edited
Code:
/etc/ssh/sshd_config
by making sure that these lines are present:
Code:
PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no

Today, I came across a Stack Exchange post that referred to macOS updates returning
Code:
/etc/ssh/sshd_config
back to factory settings. It dates back to when Monterey was the current macOS. Is this still an issue with Ventura?

If so, how do we fix that?
 

fivenotrump

macrumors 6502a
Apr 15, 2009
650
442
Central England
In the past, I have edited
Code:
/etc/ssh/sshd_config
by making sure that these lines are present:
Code:
PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no

Today, I came across a Stack Exchange post that referred to macOS updates returning
Code:
/etc/ssh/sshd_config
back to factory settings. It dates back to when Monterey was the current macOS. Is this still an issue with Ventura?

If so, how do we fix that?
Yes, this still happens with Ventura. I run a post-update script which restores my edits to /etc/ssh/sshd_config as well as some other stuff that is over-written by OS update.
 

DominikHoffmann

macrumors 6502
Original poster
Jan 15, 2007
477
468
Indiana
Yes, this still happens with Ventura. I run a post-update script which restores my edits to /etc/ssh/sshd_config as well as some other stuff that is over-written by OS update.
Would you mind posting your script here?

Do you know anything about what the Stack Exchange post says about editing
Code:
/etc/ssh/sshd_config.d/*.conf
? I don’t know what the wildcard “*” would stand for.
 

fivenotrump

macrumors 6502a
Apr 15, 2009
650
442
Central England
Would you mind posting your script here?

Do you know anything about what the Stack Exchange post says about editing
Code:
/etc/ssh/sshd_config.d/*.conf
? I don’t know what the wildcard “*” would stand for.
/etc/ssh/sshd_config includes a line
Include /etc/ssh/sshd_config.d/*
(see the comments in /etc/ssh/sshd_config)
which means include all files under the directory /etc/ssh/sshd_config.d
and these are supposed to take preference.

This is probably the cleanest way to do it:
just create a file in this directory containing your preferred entries.
I use a clunky old script which I've used 'forever' and does other things.
 
  • Like
Reactions: DominikHoffmann

DominikHoffmann

macrumors 6502
Original poster
Jan 15, 2007
477
468
Indiana
/etc/ssh/sshd_config includes a line
Include /etc/ssh/sshd_config.d/*
(see the comments in /etc/ssh/sshd_config)
which means include all files under the directory /etc/ssh/sshd_config.d
and these are supposed to take preference.

This is probably the cleanest way to do it:
just create a file in this directory containing your preferred entries.
I use a clunky old script which I've used 'forever' and does other things.
Besides the three lines I mentioned in the original post, do you make other modification to your sshd_conf file related to only allowing key-based authentication?
 

fivenotrump

macrumors 6502a
Apr 15, 2009
650
442
Central England
Besides the three lines I mentioned in the original post, do you make other modification to your sshd_conf file related to only allowing key-based authentication?
Besides the three lines I mentioned in the original post, do you make other modification to your sshd_conf file related to only allowing key-based authentication?
no, I don't think so

BTW: ChallengeResponseAuthentication is now KbdInteractiveAuthentication
(see OpenSSH 8.7 release notes)
and
% sudo sshd -T
shows the current config
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.