Home » Categories » Multiple Categories |
Initial Server Setup with Debian 7 |
Article Number: 199 | Rating: Unrated | Last Updated: Sun, Jan 5, 2014 at 8:19 PM
|
The BasicsAfter you have deployed your new server instance, it is important to create a new user and provide it with root privileges. This not only makes your virtual server more secure, but also prevents any drastic system damage/change that can happen when operating as root.1) Root LoginOnce you know your IP address, login as the "root" user from the command line.ssh root@xxx.xxx.xx.xxPrompt: Are you sure you want to continue connecting (yes/no)? Go ahead and type yes. Potential WarningIf you happen to receive a "man in the middle" warning, this is most likely because another fingerprint is associated with the virtual server's IP. To fix this, simply remove the files in the .ssh/known_hosts directory by utilizing the "remove" command:rm .ssh/known_hostsRetry logging in as the root user. 2) Change Your PasswordCurrently, you do not have a root password with your freshly registered server instance . The next step is to change it to one of your choice from the command line:passwdIt will ask you to type and confirm a password of your choice. 3) Create a New UserIn this step, we will make a new user and give them all of the root capabilities.You can make your username whatever you wish. Here, we'll be using "demo"-- simply replace it with your chosen username when applicable. adduser demoAfter you set the password, you do not need to enter any further information about the new user. You can leave all the following lines blank if you wish. 4) Root PrivilegesAs of yet, only root has all of the administrative capabilities. We are going to give the new user the root privileges.When you perform any root tasks with the new user, you will need to use the phrase "sudo” before the command. This is a helpful command for a few reasons, primarily in that it prevents the user from making any system-destroying mistakes and stores all the commands run with sudo to the file ‘/var/log/secure' (which can be reviewed later if needed). Let’s go ahead and edit the sudo configuration. This can be done by using a text editor: visudoFind the section called user privilege specification. It will look like this: # User privilege specification root ALL=(ALL:ALL) ALLAdd the following line right below the root privilege specification, granting all the permissions to your new user: demo ALL=(ALL:ALL) ALLType ‘cntrl x’ then 'y' to save and exit the file. Hit 'enter' to return to the command line. 5) SSH as New UserAt the moment, you are still logged into the root directory. In the future, login to your server directly with your newly setup username:ssh demo@xxx.xxx.xx.xxHowever, since you are already logged into your server as root, you can save time by using the sudo command to change over to your new user. su demoRemember, although you are now logged into your new username, you are still operating in the root directory. Simply use the cd command in order to switch over to your username's home directory. Now you're all set! |
Attachments
![]()
There are no attachments for this article.
|
How To Install Wordpress on Arch Linux
Viewed 2638 times since Sun, Dec 29, 2013
How To Install Wordpress on Ubuntu 12.04
Viewed 2670 times since Tue, Dec 24, 2013
How To Install phpMyAdmin on a LEMP server
Viewed 2498 times since Thu, Dec 26, 2013
How to Setup and Configure an OpenVPN Server on Debian 6
Viewed 2499 times since Thu, Dec 26, 2013
How To Create a New User and Grant Permissions in MySQL
Viewed 3345 times since Thu, Dec 26, 2013
How To Install Opigno on Debian 7 with Git and Drush
Viewed 3919 times since Sat, Jan 4, 2014
How To Use HAProxy to Set Up MySQL Load Balancing
Viewed 8266 times since Thu, Dec 26, 2013
How To Install and Secure phpMyAdmin on Debian 7
Viewed 3741 times since Fri, Dec 27, 2013
How To Set Up a Postfix Email Server with Dovecot: Dynamic Maildirs and LMTP
Viewed 3664 times since Mon, Dec 30, 2013
How To Manage Packages In Ubuntu and Debian With Apt-Get & Apt-Cache
Viewed 6847 times since Fri, Dec 27, 2013
|