Great.
1st thing check what users you have setup by:
cd /home
Then
ls
Each directory will be a user, if you donât recognize any you can delete the user with the following command:
sudo deluser username
Then remove their directory
sudo deluser --remove-home username
Now check if you have a swap as one will not be created by OVH by default.
free
If you only see one line which is MEM then you need to create a swap.
Assuming you only want 1GB swap (1000mb), enter the following:
sudo touch /var/swap.img
sudo chmod 600 /var/swap.img
sudo dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
sudo mkswap /var/swap.img
sudo swapon /var/swap.img
Check enabled by:
free
You should see two lines, one Mem and one Swap
Now add to fstab so swap is loaded on reboot:
sudo nano /etc/fstab
Add the following at the end of the file:
/var/swap.img none swap sw 0 0
Next create a new user for SSH:
sudo adduser NewUsername
and populate the prompts with name password etcâŚ
Give sudo permission for new user âNewUsernameâ
sudo usermod -aG sudo bench
Setup SSH by logging in as new user:
su - sudo NewUsername
mkdir .ssh
chmod 700 .ssh
nano .ssh/authorized_keys
In the authorized_keys file paste in a new Public key you create by following this.
You just need to follow the windows portion to create your keys.
Once you have saved the authorized_keys, you should now be able to SSH to NewUsername with you SSH keys. Try this now to make sure it is working before following the final step.
Next, we need to lock down SSH so it only users with a key can as per the above:
[quote=âabbas, post:32, topic:48101â]
sudo nano /etc/ssh/sshd_config
Scroll down and find PermitRootLogin
to no and PasswordAuthentication
to no. Remove any # at the beginning of the line.
[/quote].
If you want to further lock down SSH, I would restrict the IPs by:
sudo nano /etc/hosts.deny
Add:
sshd : ALL EXCEPT /etc/ssh.whitelist
Then:
sudo nano /etc/ssh.whitelist
Add the IP address which is the only one which allows SSH. Only do this if you have a fixed IP.
Donât forget to reboot the server:
sudo shutdown -r now
Does that help?