After successfully creating your droplet, you should receive an email from digital ocean with your root credentials. Something like:
Now you have your root access to your server. Using however this root access all the time is not safe, so the first thing we are going to do is create another user. For that we need a terminal program, or you can use the web interface as well – by clicking on your droplet on the droplets list.
Setting Up Putty
After downloading putty you can immediately start it.
Paste your server IP address to the Host Name field. Save this configuration for faster access later.
After inputting your server IP address you can hit the Open button to open the SSH connection. If the IP address is correct, then you should see your server login screen.
Type in “root” for the username and the password (from the email). After successful login you should be greeted with a similar message.
Success. You are now logged in. Take a look at the terminal screen. It currently says that you can already access your web server in your browser with it’s IP address. It also outputs your MySQL root password. Note that password temporary, you will need it later.
Adding a new user
Using the root user is not secure whatsoever, so it’s recommended to create another user account and use that instead. Why? Mostly because the root user has all the administrative privileges, and you don’t want to accidentally destroy anything.
With the adduser command we can create another user, in this example I will use “demo”.
After hitting enter you will be asked to create a password, etc..
Great work so far. Now we need to ensure that this user will be capable of running administrative commands sometimes. For this we need to give him root privileges with the following command:
gpasswd -a demo sudo
This ensures that the demo user will be capable of using the sudo command. Some tasks require root privileges, this shall be run with the sudo command.
You can close your terminal now and log in with the newly created demo user.
For more in depth tutorial you should check out this digital ocean’s initial server setup tutorial.
- Chapter #1 – Preparation & Backup
- Chapter #2 – Droplet Setup
- Chapter #3 – SSH and Users
- Chapter #4 – Virtual Hosts
- Chapter #5 – phpMyAdmin
- Chapter #6 – FTP & SFTP
- Chapter #7 – Mailing
- Chapter #8 – Swap file
- Chapter #9 – Saving space automatically