Setup Fresh CentOS Linux Web Server

Create User

Create New SSH User and add to Sudoers File

This will create the user, setup the password and open up the sudoers file for editing.

$ useradd <username>
$ passwd <username>
$ vi /etc/sudoers

Add your new user below the line where the “root” user is defined.

root          ALL=(ALL)       ALL
<username>    ALL=(ALL)       ALL

Setup Public/Private Key Pair

This is optional, but is a good idea.


Add a Little Security

Use a Non-Standard Port

Port 22 and 2222 are some of the most commonly used.  Try something else, especially something higher than 1024. Yes, this is just a little security by obscurity, but it helps cut down on a lot of attacks. Just don’t get too complacent thinking this will solve all your hacking issues.

Edit /etc/ssh/sshd_config and add a line like this…

# Run ssh on a non-standard port:
Port 2345  #Change me

Restart sshd service…

$ service sshd start


Next Steps

  1. Setup a LAMP Stack on CentOS
  2. Install git…
    sudo yum install git
  3. Install unzip…
    sudo yum install unzip
  4. Change your hostname
  5. Anything else that suits your fancy
0 0 vote
Article Rating
in CentOS
Notify of
Inline Feedbacks
View all comments