1. Home
  2. Cloud
  3. How to set up your Debian 9 server

How to set up your Debian 9 server

Set Up Overview

Debian is a powerful open-source linux distribution that is easy to install and secure. It is Ubuntu’s dad. Many great universities and corporate entities are using Debian to support their online goals.

After buying your janeCloud server running Debian 9 x64, we recommend several set up steps to customize your new cloud server before you start using it or installing any software layer onto the new environment.

This will help protect your server and increase it’s effectiveness for multiple purposes.

Get your cloud server’s credentials

1. After successful payment is approved, your server will be set up within 2 minutes.

2. Login to My HostJane. In the Dashboard under Services, look for the Debian server you have provisioned.

debian-manage-dashboard

If you cannot see the Debian server or the cloud server is not active, please open a ticket.

3. Click Manage next to the Debian server item. You will be transferred to the server’s dashboard.

server-information-dashboard-OS

Identifying your root password

4. Go to the Statistics area to find your cloud server’s IP address and password.

Sample screenshot of the Cloud Information.

statistics-dashboard

The Main IP is your janeCloud’s IP address.

The Default Password is the root password.

5. Use the information from Statistics to login either with PuTTY on Windows or an OpenSSH client in linux and MacOS devices:

ssh root [Your_Server's_IP]

Replace Your_Server’s_IP with the janeCloud IP address given in Statistics.

Create a new user

For security reasons it’s best not to use the root user for everyday administrative tasks. The solution is to create a new user.

Type the following on the command line:

adduser janedoe

Replace janedoe with the unique name of your new user.

You will be automatically asked to set a new password for janedoe, and to reenter the password to confirm.

Press Enter to proceed with default information, otherwise enter values for your:

  1. Full name
  2. Room number
  3. Work phone
  4. Home phone
  5. Other

So that we don’t have to keep logging in and out between the new user and root accounts, we can add super-user privileges to the new user account.

However sudo is not installed as standard on Debian 8 or 9. Before we can give janedoe super-user privileges by adding her to the sudo group, we first need to install sudo

How to install sudo on Debian

We use the command apt-get

Type:

apt-get update

When the apt package has finished updating, install sudo with:

apt-get install sudo

You should still be logged in as the root user.

Now we can use sudo commands to give the new user, janedoe,root privileges:

usermod -a -G sudo janedoe

You can now run janedoe with the same level of access as the root user.

We recommend setting up public SSH keys to secure your server.

Steps for how to generate and set up SSH key pairs are beyond the scope of this guide.

After you’ve set up your SSH keys, open another terminal on your local machine and add your SSH key to janedoe‘s home directory.

ssh-copy-id janedoe@Your_Server's_IP

With the SSH key now installed, log back into your janeCloud server using the root user

Switch to janedoe to enter her home directory

su - janedoe

Create a new directory .ssh and restrict permissions:

mkdir ~/.ssh

Ensure there are no spaces between / and .ssh

chmod 700 ~/.ssh

Use nano, the command-line text editor, to edit the authorized_keys file in .ssh directory by typing:

chmod 600 ~/.ssh/authorized_keys

Type exit to switch back to the root user.

Verify the configuration

Check that janedoe can successfully log into her janeCloud using SSH.

Type:

SSH janedoe@[Your_Server's_IP]

If successful, you will login to your janeCloud using your private key, and will not be asked for a password.

Secure your janeCloud server by disabling root logins

Only disable root logins if you have set up SSH keys on the server, otherwise you’ll be locked out.

Edit the SSH daemon file to prevent unauthorized users logging into your janeCloud using password authentication.

Use nano, the command-line text editor, to open the SSH daemon file (after logging in with your SSH new super-user, janedoe) by typing:

sudo nano /etc/ssh/sshd_config

Find PermitRootLogin, it will look like this:

PermitRootLogin yes

Set it to no using your cursor

PermitRootLogin no

Press ctrl + O then Enter to write the changes to SSH daemon

Now close the file with ctrl + x

Reload SSH

To save the changes, restart the SSH service:

sudo systemctl restart ssh

You are now ready to start using your new janeCloud server running Debian 9 and begin installing any software.

Updated on October 24, 2018

Was this article helpful?