Jump to content



Photo

The Proper Way of First starting a Linux Server - Posted By Kolpa


  • Please log in to reply
No replies to this topic

#1 Cryo Kinesis

Cryo Kinesis

    Haphost Staff

  • Moderators
  • 128 posts
  • LocationGridania, Eorzea

Posted 05 August 2014 - 06:09 PM

Index
1.Hello There
2.Setting up sudo
3.Creating the account
4.Logging in and root management


1. Hello there

so as you all know there are many tutorials around here that show you how to connect to your vps and each of them is nicely made for what it is but none of them actually cover how to use proper security standards.
note that this guide will assume that you have root access to your vps and are on Debian/Ubuntu.
if you are on Ubuntu start at step 3.
as a Debian users begin at step 2.

2.Setting up sudo

now this is pretty straightforward all you need to do is to type the following into your root console:

apt-get install sudo
after this is done you are ready for step 3

3.Creating the account

The whole point of this Tutorial is to teach you not to use the root account at any time when it is not necessary so in this step we create a new account and give it the needed rights.
at first you will create the new account using the command

adduser "username"
fill out all the data that the script asks for.
next we need to give sudo rights to the given account we do this by running the command
visudo
which will open the sudoers file in the default text editor.
now you will add the following line to this file
username ip/subnet=(ALL) ALL
where username is your account name ip is your ip adress and subnet is your subnet mask so for
example
kolpa 123.456.789.0/255.255.255.0=(ALL) ALL
this will make sure that anyone using sudo on the account kolpa with the ip 123.456.789.0 - 123.456.789.255 can use all command that need root access if he writes sudo in front of them.
now that this is done you are ready for step 4
 
4.Logging in and root management

in this step we discuss when to use the root account usually the safest way to go is saying NEVER but this rules (as always) has some exceptions these are for example your ip changing and you not being able to use sudo because of that.
now and this is important: only and i repeat ONLY use the root account to fix the sudoers file and then log back out.
never just keep using it because well you where logged in anyways this defeats the whole purpose of creating the other account.

Thank you for your time reading this and i hope i made the experience of using a v server better for all of us


  • Pete likes this

Cryo%20Kinesis%20Haphost%20Sig2.png





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users