Tag ssh

Changing default SSH port

Tags: , ,

By default, the SSH port is set to 22.
Locate the following line in the file /etc/ssh/sshd_config:
#Port 22

Remove # and change 22 to your desired port number. Though make sure you do not use the ports which are used by other systems ( i.e. 465,993 which are mail ports etc).

Save the changes and close the file. Press Ctrl + O to save. Type Ctrl + X to exit.

To apply the settings, the SSH service needs to be restarted. If you are logged in as a techuser (or your custom created one to replace root), you will need to use the sudo command to perform this action.

sudo systemctl restart sshd

Disable 2 factor authentication via ssh on a cPanel

Tags: , , ,

To disable it via command line, ssh to the server and run this command:

whmapi1 twofactorauth_disable_policy

This turns two-factor auth off. However, it does not delete the current two-factor setups. So before you turn two-factor back on, you need to disable the two-factor code from your account

Log into WHM
Click on Two-Factor Authentication
Click on “Manage My Account”
Click on Remove Two-factor Authentication
This will remove the current two-factor code from the root user, allowing you to setup a new one.