Linux

Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

Setup Ubuntu Server

Avatar
Administrator
Avatar
Discard
1 Answer
0
Avatar
Administrator
Best Answer

Introduction

Step by step to setup Ubuntu Server and configure the initial users and security for the server.

Update Root Password

The very first thing that you should do is change your root password.

Enter the following command

passwd root

you will be asked to enter your root password .  You should choose a strong password for your root user.

 

Step 1 -Create New User

We will create a new user with root privileges.  Root account will then be disabled

Enter the following  command and using the account name of your choice

You will be asked to enter password

 

adduser youradminuser

Now give root privileges to new user

usermod -aG sudo youradminuser

Step 2 -Create Private Key Pair

The private key will be used to unlock access from any device that needs it. The Public Key will be on the server.

ssh-keygen

Choose the default for the file location.

If you want extra security you can add a passphrase 

Once your keys have been created, you will find them in /home/root/.ssh – there should be id_rsa (private key) and id_rsa.pub (public key) files in that directory.

ssh-copy-id youradminuser@[server IP]

Yes to continue and enter password for youradminuser

Step 3 -Configure SSH Settings

Edit SSH configuration file

nano -w /etc/ssh/sshd_config

Edit default port number

#Port 22

Change to new port number (You can use any port number)

Port 2222

Change 

PermitRootLogin yes

To

PermitRootLogin no

Now disable password Authentication

Change 

#PasswordAuthentication yes

To

PasswordAuthentication no

Save configuration 

Press CTRL+X followed by ‘Y’ and ‘Enter’ to save and exit.

Restart SSH

systemctl reload sshd

Step 4 -Download Private Key
 

cat ~/.ssh/id_rsa

Select the entire contents and press CTRL+INS to copy 

Paste the file into Notepad and save it to a secure location

and delete the id_rsa file from the server

 

rm ~/.ssh/id_rsa

Step 5 -Convert Private Key Format

You need to convert it to .PPK format.

First, run PuTTYgen and click the ‘Load’ button.  Browse to the private key file that you saved in step 7.  

When browsing for your private key, change the file type you are searching for from ‘PuTTY Private Key Files (*.ppk)’ to ‘All Files (*.*).’

 

Open your private key file, and you should receive a notice that the private key was successfully imported. 

Click OK to get off of this notification.

Now, click the ‘Save private key’ button and save your private key as a .ppk file 

(I usually just use the same directory that I used to save the original private key).  

You can now close PuTTYgen.


Avatar
Discard