Phoenix Ignited is a proud tech solutions partner of Luxauro.com. View their news and media page here: Luxauro.com
This post dives deep (well as deep as a few terminal lines gets) into: creating a new user, giving the new user sudo powers, and finally how to disable root access via ssh on your linux server. Currently this tutorial covers Debian / Ubuntu distros, we aim to add more linux distros in the future.
Login to your vps and enter: adduser (username) replace (username) with the username of your choice, the system will ask you to create a password and to confirm the password and then give you the option to add more info such as name, office number etc. You can skip through all that by hitting enter.
adduser (username)
Next enter usermod -aG sudo (username) into the terminal. This gives your new user sudo abilities. Before proceeding onto disable root access, it is heavily recommended that you logout of the vps (type exit in the terminal) and log back in as your new user and insure the new user account has sudo powers.
usermod -aG sudo (username)
Login is as your sudo user and type sudo vi /etc/ssh/sshd_config into the terminal (this opens up the ssh config file in the vi editor for us to modify). Scroll to the line that says PermitRootLogin and change it from yes to no then save the file by hitting esc and then entering :wq. Now restart ssh via the command service ssh restart. That is it!
sudo vi /etc/ssh/sshd_config
sudo service ssh restart
Walter is a tech entrepreneur and in his free time loves fitness, art, writing, and exploring Montana’s outdoors.
+ Ave Maria +