Do not do this. The first line tells sshd not to check that the permissions on your users' home directories and authorized_keys are correct before trusting them. You do not need that by default. You do not need it unless some permissions are very wrong. No part of your procedure sets any wrong permissions as far as I can see, so you should not need it at all.~ # sed -i 's/#StrictModes yes/StrictModes no/g' /etc/ssh/sshd_config
~ # sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/g' /etc/ssh/sshd_config
If you did have wrong permissions on your systems, you should have corrected them instead of turning off the checks. You certainly should not recommend other people blindly turn off security checks to cover for an error on your part.
The second line uncomments a setting that is already the default. As explained at the top of the file, the commented out settings are the defaults. Furthermore, if someone did happen to have "PubkeyAuthentication no" set, then whether your command overrides that depends on the relative order of the conflicting "yes" and "no" settings, which is not very helpful.
Just use the default settings and the default permissions. (You do not even need the chmod after the ssh-keygen, because the program automatically sets 0600 on private key files.)
Statistics: Posted by jojopi — Tue Aug 26, 2025 1:32 am