Enforce SSH or SCP password authentication

Use the bellow ssh/scp options in order to enforce password (keyboard-interactive) authentication:

ssh -o PubkeyAuthentication=no user@example.com
scp -o PubkeyAuthentication=no user@example.com


ssh -o PreferredAuthentications="password" user@example.com
scp -o PreferredAuthentications="password" user@example.com

How to connect without a password via ssh?

To connect without a password via SSH, you can use public key authentication. Public key authentication is a secure and convenient way to log in to a remote server without entering a password each time.

Here’s a step-by-step guide to setting up passwordless SSH authentication:

1. Generate SSH key pair: On your local machine, generate an SSH key pair if you haven’t already done so. Open a terminal and run the following command:

ssh-keygen -t rsa

This will generate a pair of keys: a private key (usually id_rsa) and a public key (usually id_rsa.pub).

2. Copy the public key to the remote server: Use the following command to copy your public key to the remote server you want to connect to:

ssh-copy-id username@remote_host

Replace username with your username on the remote server and remote_host with the hostname or IP address of the remote server. You will be prompted for your password on the remote server.

If the ssh-copy-id command is not available on your system, you can manually append the content of your public key (id_rsa.pub) to the ~/.ssh/authorized_keys file on the remote server.

3. Configure SSH on the remote server: SSH server configuration should allow public key authentication. On the remote server, open the SSH server configuration file (usually located at /etc/ssh/sshd_config) using a text editor.

Locate the line that starts with #PubkeyAuthentication yes and remove the leading # to uncomment the line. If the line doesn’t exist, you can add it.

Save the changes and exit the text editor.

4. Restart SSH service: Restart the SSH service on the remote server to apply the changes you made to the configuration file. The command to restart SSH depends on your operating system. For example, on Ubuntu, you can use:

sudo service ssh restart

Alternatively, you can use the following command if you are using a system with systemd:

sudo systemctl restart sshd

5. Test the passwordless SSH login: Try to SSH into the remote server without a password:

ssh username@remote_host

Replace username with your username on the remote server and remote_host with the hostname or IP address of the remote server. If everything is set up correctly, you should be able to log in without entering a password.

That’s it! You have successfully set up passwordless SSH authentication. Now you can log in to the remote server without typing your password each time.

Enforce SSH Connections Alive

Here are a couple of option you have in order to keep the SSH connection alive

$ ssh -o ServerAliveInterval=60 <user>@<ip>

The above will instruct the ‘ssh’ client to sent “alive” packets every 60 seconds.

The following will set the same as default (by adding the option to your ssh client’s configuration file) for each ssh connection.

$echo -e "Host *\n\tServerAliveInterval 60" >> $HOME/.ssh/config

Optimize MySQL tables

Optimize single database table:

mysql> OPTIMIZE TABLE my_table


Optimize entire database:

shell# mysqlcheck -op -u root your_database_name


Optimize ALL databases:

shell# mysqlcheck -u root -p --auto-repair --check --optimize --all-databases


1. Download the later rkhunger version from sf.net: http://sourceforge.net/projects/rkhunter/
2. shell# tar -zxvf tar -zxvf rkhunter-1.4.0.tar.gz
3. shell# cd rkhunter-1.4.0
4. shell# ./installer.sh –layout default –install
5. shell# /usr/local/bin/rkhunter –update
6. shell# /usr/local/bin/rkhunter –propupd
7. shell# vi /etc/cron.daily/rkhunter.sh
8: Add the following configuration to rkhunter.sh cron script:

-=-=- cut -=-=-
/usr/local/bin/rkhunter –versioncheck
/usr/local/bin/rkhunter –update
/usr/local/bin/rkhunter –cronjob –report-warnings-only
) | /bin/mail -s ‘rkhunter Daily Run (PutYourServerNameHere)’ your@email.here
-=-=- end -=-=-

9. chmod 700 /etc/cron.daily/rkhunter.sh
10. You’re good to go 🙂