Disable root SSH access and setup sudo user on CentOS

Disabling root SSH logins and adding an additional sudo user is a good security measure for any linux system.

First we need to disable root login for the SSH server, edit the following file

Find the following section:
PermitRootLogin yes

Change it to:
PermitRootLogin no

Save the file.

Next we need to add our additional user, name it whatever you want:
adduser myusername

Then set a password for the user:
passwd myusername

Now we need to edit the following file to add the new user to the wheel group:

Find the following line:

Change it to the following with your new user added:

Save the file and restart the SSH service:
service sshd restart

Now if you try to connect to your server via SSH as root it should give you an incorrect password error. You can login with the new user you've just made now, and run the "su -" command as the new user to run as root.

  • centos, disable root
  • 29 Users Found This Useful
Was this answer helpful?

Related Articles

Install ownCloud on CentOS 6

We will be setting up ownCloud on a fresh CentOS 6.6 64-bit installation. ownCloud is an open...

Install PPTP / PPP Proxy Server on CentOS 6

PPTP Proxy is an easy to setup proxy server that can be used as an OpenVPN alternative, and many...

Install VNC Server and Desktop on CentOS 6

Install the desktop environment that we will use:yum groupinstall Desktop -yInstall the TigerVNC...

Install Multicraft 2.0 on CentOS 6

Run a Minecraft server? Multicraft is the most commonly used management control panel for...

Setup Teamspeak 3 Server on Linux (CentOS)

If you run a gaming community, a Teamspeak 3 server is probably a popular choice for you to have...

Powered by WHMCompleteSolution