How to audit SSH server and client config on Linux/Unix

@nixcraft recently posted a great tutorial about how to audit an SSH server at cybercity.biz/tips/how-to-audit-ssh-server-and-client-config-on-linux-unix.html

The reason for this post is to help anybody who crosses the same problem that I did. I tried to leave a comment and the server kept on rejecting it.

Here is the problem I found wiht the tutorial, easy to fix, may be Vivek will add this to it.

sudo awk ‘$5 >= 3071’ /etc/ssh/moduli > /etc/ssh/moduli.safe
-bash: /etc/ssh/moduli.safe : Permission denied

Doesn’t work in Ubuntu 20.04 with everything upgraded to 6-3-2021 12: noon
two choices,

  1. if you don’t want to create a root password, do

sudo awk ‘$5 >= 3071’ /etc/ssh/moduli

then highlight all the output in the screen from:

Time Type Tests Tries Size Generator Modulus


to the end of the file, then right click and copy the content to the clipboard.
then execute

sudo nano /etc/ssh/moduli.safe

and do a right click and paste into the file, after that s followed by x.
from there follow the tutorial as is.
didn’t follow this path, so you may need to change some permission on this file created with the editor, please comment here if you have to.

  1. if you decided to create a root password (be aware there’re dangers to this),
    do:

sudo password

and then enter your password if asked, followed by the desired root password and confirm it.
then type

su

and enter the root password!
Success, now you are in real dangerous territory, you can do anything…

Welcome @Julio_Spinelli

Ah, yes. The WP keep rejecting because it thinks commands are malicious. I will look into post again and update the page. Thanks for the feedback.


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki