Secure your Ubuntu 10.04 server

Categories: Ubuntu; Tags: SSH, ubuntu;

Login with putty or any other ssh client as root with your assigned password

ssh root@173.203.206.78

You can change your root password if you need to with the following command:

passwd

Add your own user:

adduser jdoe

If you want that sudo su command not to ask for a password:

visudo

Add the following line at the end of the file

jdoe ALL=NOPASSWD: ALL

I am logging in from Windows so I used Putty and Puttygen to create a new PPK key in order to log in Issue the following commands:

mkdir /home/jdoe/.ssh

Add the public key into your authorized_keys file:

vi /home/vlad/.ssh/authorized_keys

Secure the files:

chown -R jdoe:jdoe /home/jdoe/.ssh 
chmod 700 /home/jdoe/.ssh 
chmod 600 /home/jdoe/.ssh/authorized_keys

Now you have to configure the SSH Daemon:

vi /etc/ssh/sshd_config

And change the following lines:

Port 22222
PermitRootLogin no
PasswordAuthentication no
X11Forwarding no
UsePAM no
UseDNS no
AllowUsers jdoe 

Also make sure that AuthorizedKeysFile %h/.ssh/authorized_keys is uncommented

Restart your sshd service or your server.

sudo /etc/init.d/sshd restart

That concludes the SSH configuration for a password-less log in to your VPS.


Books

NginX HTTP Server

The book includes detailed instructions for each of the processes it describes: downloading and installing the application, configuring and using modules, and much more. It provides a step-by-step tutorial to replace your existing web server with Nginx. With commented configuration sections and in-depth module descriptions, you will be able to make the most of the performance potential offered by Nginx.

Source: Packt Publishing

Google AdSense

Affiliates