Creating a user in ubuntu server

Creating a user in ubuntu server

1) Start a new Amazon instance as usual 2) Install all LAMP package as usual - depending on the Linux plaform you use - Centos or Ubuntu 3) Test the LAMP install - creat a file info.php in servers root folder and paste the following code;

<?php
phpinfo();

4) Navigate to info.php via browser and make sure you have all necessary extensions installed and working properly.

5) Now you need to create a new - non root user

  • ssh to server

  • create a new user on the sever - use "useradd" command (check with ubuntu and centos documentation for correct application of this command)

  • Amazon instances do not use password authentication so you need ssh public key for the user. In most cases I inquire this from third party agency.

  • On new use's home folder (usually /home/username) create a new folder .ssh and change its owner to "username" - chown -R username:username .ssh

  • inside .ssh create a file authenticated_keys and paste a public key you got in step 5.3 and save the file. Again, make sure that file has correct ownership and read only access rights.

  • Under /mnt/ create new folder sites and inside sites create root folder for your "Third party" web project. Change the ownership for that folder only to match with username.

  • Set up a new virtual host for "Third party" with its root pointing to folder you created in previous step.

6) That's it you are done.

To "namespace" all folder, usernames, etc I usually use Agency's name or projects name.

New user, has no "root" access to STC Amazon instance, hence this is quite secure form our side. 

List all Users

To list users on lynux basted operating system do this:

cat /etc/passwd