SlideShare a Scribd company logo
1 of 11
Download to read offline
BASIC SETUP FOR LINUX OPERATING SYSTEM
BY
ARSLAN UD DIN SHAFIQ
DIRECTOR & CEO OF WEBSOFT IT DEVELOPMENT SOLUTIONS PRIVATE LIMITED
ALIBABA CLOUD MVP
DZONE MVB
Basic Setup for CentOS, Ubuntu, Debian, SUSE Linux,
OpenSUSE, Aliyun, CoreOS, FreeBSD
Purpose & Objectives:
The purpose of this tutorial is to teach you some basic and necessary configurations that you
must do on your Alibaba Cloud ECS. Major objectives of this tutorial are:
 Introduction of Linux OS
 Advantages of Linux Server
 Use of Linux Server
 Available Linux distributions in Alibaba Cloud public images
 Prerequisites for using Alibaba Cloud ECS
 Add a user in different Linux OS distributions
 Add user in sudo group to assign root privileges
What is Linux?
Linux is an open source operating system (OS) available for desktop as well as server. In Linux,
you don’t need to pay any cost for License to use Linux Operating System.
Advantages of Linux Server
Linux is much faster and every task is few commands ahead in Linux. Linux is much secure as
compared to other operating systems. Linux is light weight and works smoothly in limited
resources.
Linux is OS, not application. There are endless options of apps that you can install and use on
Linux server. Either you want to host an application or you want to host a game, either you
want to host files or you want to host some media, you can use Linux and install your required
applications with few commands.
Uses of Linux Server
You can use a Linux server as application server, web server, catalog server, computing
server, communication server, fax server, database server, gaming server, file server, mail
server, print server, media server, sound server, proxy server and virtual server. Graphical
user interface (GUI) is optional in Linux. If you are not good with using command line, you
can install GUI via command line and use it. [1]
Available Linux distributions in Alibaba Cloud public images
There is a big range of Linux distributions available for various purposes. Alibaba Cloud offers
some public images available for installation that are CentOS, Ubuntu, SUSE, OpenSUSE,
Aliyun, CoreOS, but you can use your own image as well.
Prerequisites:
1. You must have Alibaba Cloud Elastic Compute Service (ECS) activated and
verified your valid payment method. If you are a new user, you can get free $300
credits in your Alibaba Cloud account. If you don’t know about how to setup your
ECS instance, you can refer to this tutorial or quick-start guide.
2. ECS must have at least 1GB RAM and 1 Core processor.
3. A domain name registered from Alibaba Cloud. If you have already registered a
domain from Alibaba Cloud or any other host, you can update its domain
nameserver records.
4. Domain name must be pointed to your Alibaba Cloud ECS’s IP address.
5. You should setup your server’s hostname.
6. Access to VNC console in your Alibaba Cloud or SSH client installed in your PC.
Getting started:
1. After completing the prerequisites, login as root user with your root username &
password via SSH client (e.g. Putty – You can get Putty from https://www.putty.org )
or VNC console available in your Alibaba Cloud account dashboard.
How to add a User with Root Privileges?
In the first step, you will add a new user, then you will give it root privileges by adding it in
sudo group. Sudo privileges will allow this username to make administrative changes on
system when required. This user will be used to login from via SSH for everyday use. Once
you have added this user, to keep your server secure from various attacks, you will disable the
remote root access to root user.
CentOS / Aliyun:
1. To create a new user account, use the following command:
# adduser aareez
where “aareez” can be any username of your choice.
2. Now you will need to set password for your added username. To set password, execute
the following commands:
# passwd aareez
Now set your desired password and retype your desired password, then hit Enter key.
To confirm the data is correct, type ‘Y’ and hit Enter key.
3. Now assign username to sudo user’s group to give administrative privileges. For this,
we will check /etc/sudoers file and see whether sudoers group is enabled or not. For
this purpose, we will execute the following command.
# visudo
4. After executing the above command, a file will be opened, find the following lines in
the opened file.
Sometimes by default the second line %wheel ALL=(ALL:ALL) ALL is
commented (starting with hash #), due to which even after adding username to sudoers,
it gives error on using sudo. To prevent this issue, if this line starts with ‘#’ sign, remove
this symbol and save the changes by pressing Esc key, type :x and hit enter.
5. Now you will add your username “aareez” to the “wheel” group by executing the
following command:
# usermod -aG wheel aareez
Your username has been successfully added to sudoers group and it is able to execute any root
command.
Ubuntu / Debian:
1. To create a new user account, use the following command:
# adduser aareez
where “aareez” can be any username of your choice.
2. Now you will be prompted to set password for your added username. Set your desired
password and retype your desired password, then hit Enter key. To confirm the data is
correct, type ‘Y’ and hit Enter key.
3. Now you will be asked to type your name, room no, work phone and home phone.
Provide information as per your choice and type Y and hit Enter key.
4. Now assign username to sudo user’s group to give administrative privileges. For this,
we will check /etc/sudoers file and see whether sudoers group is enabled or not. For
this purpose, we will execute the following command.
# visudo
5. After executing the above command, a file will be opened, find the following lines in
the opened file.
Sometimes by default the line %sudo ALL=(ALL:ALL) ALL is commented
(starting with hash #), due to which even after adding username to sudoers, it gives
error on using sudo. To prevent this issue, if this line starts with ‘#’ sign, remove this
symbol and save the changes by pressing Ctrl+X, then type Y and hit Enter key.
6. Now you will add your username “aareez” to the “wheel” group by executing the
following command:
# adduser aareez sudo
Your username has been successfully added to sudoers group and it is able to execute any root
command
FreeBSD:
1. To add a new user with root/admin privileges, use the following command:
# adduser
2. For “Username”, type your selected username and hit Enter key.
3. For “Full Name”, type your full name and hit Enter key.
4. For “Uid”, leave the field empty and hit Enter key.
5. For “Login group”, type wheel and hit Enter key.
6. For “Invite username into other groups?”, leave blank and hit Enter key.
7. For “Login class”, type default and hit Enter key.
8. For “Shell”, type sh and hit Enter key.
9. For “Home Directory”, type /home/your_username and hit Enter key.
10. For “Home Directory Permissions”, leave the field blank and hit Enter key.
11. For “Use password-based authentication”, type yes and hit Enter key.
12. For “Use and empty password”, type no and hit Enter key.
13. For “Use a random password”, type no and hit Enter key.
14. Now you will be prompted to enter password. Type password of your choice and hit
Enter key.
15. Retype the password and hit Enter key.
16. For “Lock out the account after creation?”, type no and hit Enter key.
17. For OK?, type yes and hit Enter key.
18. Now you will be asked to add another user, type no and hit Enter key.
19. New user with sudo/admin rights have been created successfully.
Note: “aaree” can be any username of your choice.
20. Now you will need to edit sudoers file to uncomment the line shown in screenshot
below to give sudo rights to wheel group. For this, we will check /etc/sudoers file and
see whether sudoers group is enabled or not. For this purpose, we will execute the
following command.
# visudo
21. After executing the above command, you will see the following lines in the opened
file.
Remove the # from its start to uncomment the line. Otherwise, your username will not
be able to execute sudo command.
To remove this, make your cursor on # and press r key and then press spacebar key.
After it type :x and hit Enter key to save changes..
SUSE / OpenSUSE / CoreBSD:
Note: Step 3 & 4 is not for CoreBSD.
1. To create a new user account, use the following command:
# useradd aareez
where “aareez” can be any username of your choice.
2. Now you will need to set password for your added username. To set password, execute
the following commands:
# passwd aareez
Now set your desired password and retype your desired password, then hit Enter key.
To confirm the data is correct, type ‘Y’ and hit Enter key.
3. Now assign username to sudo user’s group to give administrative privileges. For this,
we will check /etc/sudoers file and see whether sudoers group is enabled or not. For
this purpose, we will execute the following command.
# visudo
4. After executing the above command, a file will be opened, find the following lines in
the opened file.
Sometimes by default the second line %wheel ALL=(ALL:ALL) ALL is
commented (starting with hash #), due to which even after adding username to sudoers,
it gives error on using sudo. To prevent this issue, if this line starts with ‘#’ sign, remove
this symbol and save the changes by pressing Esc key, type :x and hit enter.
5. Now you will add your username “aareez” to the “wheel” group by executing the
following command:
# usermod -aG wheel aareez
Your username has been successfully added to sudoers group and it is able to execute any root
command.
How to check to which group your username belongs?
You can verify the membership for that group by executing the following command:
# groups aareez
How to switch from one user account to another?
Now, log in by using your new username and password. OR Use the following command to
switch user:
# su - aareez
How to check from which username you are logged in?
You can see that you have been logged in from your new account now. If you want to verify
this, you can use the command below:
# whoami
References
[1] A. u. D. Shafiq, "Linux OS - Why is it better?," Learn Cybers, 13 10 2019. [Online]. Available:
https://learncybers.com/linux-os-why-is-it-better/. [Accessed 13 10 2019].

More Related Content

Similar to Setup Linux User Accounts with Sudo Privileges

How to install odoo 15 steps on a ubuntu 20.04 lts system installation
How to install odoo 15 steps on a ubuntu 20.04 lts system installation How to install odoo 15 steps on a ubuntu 20.04 lts system installation
How to install odoo 15 steps on a ubuntu 20.04 lts system installation Geminate Consultancy Services
 
Cygwin installation
Cygwin installationCygwin installation
Cygwin installationMohsen B
 
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptx
 Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptxCiceer Ghimirey
 
User and group administration in Linux
User and group administration in LinuxUser and group administration in Linux
User and group administration in LinuxMohammed Yazdani
 
Hadoop 101 handson Lab
Hadoop 101 handson LabHadoop 101 handson Lab
Hadoop 101 handson LabSunil Ranka
 
Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...SlideTeam
 
Step for installing linux server
Step for installing linux serverStep for installing linux server
Step for installing linux serversyed mehdi raza
 
Free tools for win server administration
Free tools for win server administrationFree tools for win server administration
Free tools for win server administrationConcentrated Technology
 
Cara Set Up FTP server di ubuntu
Cara Set Up FTP server di ubuntuCara Set Up FTP server di ubuntu
Cara Set Up FTP server di ubuntuRobby Firmansyah
 
Operating systems 2
Operating systems 2Operating systems 2
Operating systems 2mariacalji
 

Similar to Setup Linux User Accounts with Sudo Privileges (20)

How to install odoo 15 steps on a ubuntu 20.04 lts system installation
How to install odoo 15 steps on a ubuntu 20.04 lts system installation How to install odoo 15 steps on a ubuntu 20.04 lts system installation
How to install odoo 15 steps on a ubuntu 20.04 lts system installation
 
Cygwin installation
Cygwin installationCygwin installation
Cygwin installation
 
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptx
 Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptx
 
gfd
gfdgfd
gfd
 
Sandy Report
Sandy ReportSandy Report
Sandy Report
 
Sandy Report
Sandy ReportSandy Report
Sandy Report
 
User and group administration in Linux
User and group administration in LinuxUser and group administration in Linux
User and group administration in Linux
 
sun solaris
sun solarissun solaris
sun solaris
 
Install
InstallInstall
Install
 
Hadoop 101 handson Lab
Hadoop 101 handson LabHadoop 101 handson Lab
Hadoop 101 handson Lab
 
Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...Hands On Introduction To Ansible Configuration Management With Ansible Comple...
Hands On Introduction To Ansible Configuration Management With Ansible Comple...
 
Step for installing linux server
Step for installing linux serverStep for installing linux server
Step for installing linux server
 
SSH how to 2011
SSH how to 2011SSH how to 2011
SSH how to 2011
 
Free tools for win server administration
Free tools for win server administrationFree tools for win server administration
Free tools for win server administration
 
Sudo
SudoSudo
Sudo
 
Cara Set Up FTP server di ubuntu
Cara Set Up FTP server di ubuntuCara Set Up FTP server di ubuntu
Cara Set Up FTP server di ubuntu
 
Presentation1
Presentation1Presentation1
Presentation1
 
Operating systems 2
Operating systems 2Operating systems 2
Operating systems 2
 
Cent os 5 ssh
Cent os 5 sshCent os 5 ssh
Cent os 5 ssh
 
1 system security
1 system security1 system security
1 system security
 

Recently uploaded

cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 

Recently uploaded (20)

cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

Setup Linux User Accounts with Sudo Privileges

  • 1. BASIC SETUP FOR LINUX OPERATING SYSTEM BY ARSLAN UD DIN SHAFIQ DIRECTOR & CEO OF WEBSOFT IT DEVELOPMENT SOLUTIONS PRIVATE LIMITED ALIBABA CLOUD MVP DZONE MVB
  • 2. Basic Setup for CentOS, Ubuntu, Debian, SUSE Linux, OpenSUSE, Aliyun, CoreOS, FreeBSD Purpose & Objectives: The purpose of this tutorial is to teach you some basic and necessary configurations that you must do on your Alibaba Cloud ECS. Major objectives of this tutorial are:  Introduction of Linux OS  Advantages of Linux Server  Use of Linux Server  Available Linux distributions in Alibaba Cloud public images  Prerequisites for using Alibaba Cloud ECS  Add a user in different Linux OS distributions  Add user in sudo group to assign root privileges What is Linux? Linux is an open source operating system (OS) available for desktop as well as server. In Linux, you don’t need to pay any cost for License to use Linux Operating System. Advantages of Linux Server Linux is much faster and every task is few commands ahead in Linux. Linux is much secure as compared to other operating systems. Linux is light weight and works smoothly in limited resources. Linux is OS, not application. There are endless options of apps that you can install and use on Linux server. Either you want to host an application or you want to host a game, either you want to host files or you want to host some media, you can use Linux and install your required applications with few commands. Uses of Linux Server You can use a Linux server as application server, web server, catalog server, computing server, communication server, fax server, database server, gaming server, file server, mail server, print server, media server, sound server, proxy server and virtual server. Graphical user interface (GUI) is optional in Linux. If you are not good with using command line, you can install GUI via command line and use it. [1]
  • 3. Available Linux distributions in Alibaba Cloud public images There is a big range of Linux distributions available for various purposes. Alibaba Cloud offers some public images available for installation that are CentOS, Ubuntu, SUSE, OpenSUSE, Aliyun, CoreOS, but you can use your own image as well. Prerequisites: 1. You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get free $300 credits in your Alibaba Cloud account. If you don’t know about how to setup your ECS instance, you can refer to this tutorial or quick-start guide. 2. ECS must have at least 1GB RAM and 1 Core processor. 3. A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records. 4. Domain name must be pointed to your Alibaba Cloud ECS’s IP address. 5. You should setup your server’s hostname. 6. Access to VNC console in your Alibaba Cloud or SSH client installed in your PC. Getting started: 1. After completing the prerequisites, login as root user with your root username & password via SSH client (e.g. Putty – You can get Putty from https://www.putty.org ) or VNC console available in your Alibaba Cloud account dashboard. How to add a User with Root Privileges? In the first step, you will add a new user, then you will give it root privileges by adding it in sudo group. Sudo privileges will allow this username to make administrative changes on system when required. This user will be used to login from via SSH for everyday use. Once you have added this user, to keep your server secure from various attacks, you will disable the remote root access to root user. CentOS / Aliyun: 1. To create a new user account, use the following command: # adduser aareez
  • 4. where “aareez” can be any username of your choice. 2. Now you will need to set password for your added username. To set password, execute the following commands: # passwd aareez Now set your desired password and retype your desired password, then hit Enter key. To confirm the data is correct, type ‘Y’ and hit Enter key. 3. Now assign username to sudo user’s group to give administrative privileges. For this, we will check /etc/sudoers file and see whether sudoers group is enabled or not. For this purpose, we will execute the following command. # visudo 4. After executing the above command, a file will be opened, find the following lines in the opened file. Sometimes by default the second line %wheel ALL=(ALL:ALL) ALL is commented (starting with hash #), due to which even after adding username to sudoers, it gives error on using sudo. To prevent this issue, if this line starts with ‘#’ sign, remove this symbol and save the changes by pressing Esc key, type :x and hit enter.
  • 5. 5. Now you will add your username “aareez” to the “wheel” group by executing the following command: # usermod -aG wheel aareez Your username has been successfully added to sudoers group and it is able to execute any root command. Ubuntu / Debian: 1. To create a new user account, use the following command: # adduser aareez where “aareez” can be any username of your choice. 2. Now you will be prompted to set password for your added username. Set your desired password and retype your desired password, then hit Enter key. To confirm the data is correct, type ‘Y’ and hit Enter key. 3. Now you will be asked to type your name, room no, work phone and home phone. Provide information as per your choice and type Y and hit Enter key.
  • 6. 4. Now assign username to sudo user’s group to give administrative privileges. For this, we will check /etc/sudoers file and see whether sudoers group is enabled or not. For this purpose, we will execute the following command. # visudo 5. After executing the above command, a file will be opened, find the following lines in the opened file. Sometimes by default the line %sudo ALL=(ALL:ALL) ALL is commented (starting with hash #), due to which even after adding username to sudoers, it gives error on using sudo. To prevent this issue, if this line starts with ‘#’ sign, remove this symbol and save the changes by pressing Ctrl+X, then type Y and hit Enter key. 6. Now you will add your username “aareez” to the “wheel” group by executing the following command: # adduser aareez sudo Your username has been successfully added to sudoers group and it is able to execute any root command
  • 7. FreeBSD: 1. To add a new user with root/admin privileges, use the following command: # adduser 2. For “Username”, type your selected username and hit Enter key. 3. For “Full Name”, type your full name and hit Enter key. 4. For “Uid”, leave the field empty and hit Enter key. 5. For “Login group”, type wheel and hit Enter key. 6. For “Invite username into other groups?”, leave blank and hit Enter key. 7. For “Login class”, type default and hit Enter key. 8. For “Shell”, type sh and hit Enter key. 9. For “Home Directory”, type /home/your_username and hit Enter key. 10. For “Home Directory Permissions”, leave the field blank and hit Enter key. 11. For “Use password-based authentication”, type yes and hit Enter key. 12. For “Use and empty password”, type no and hit Enter key. 13. For “Use a random password”, type no and hit Enter key. 14. Now you will be prompted to enter password. Type password of your choice and hit Enter key. 15. Retype the password and hit Enter key. 16. For “Lock out the account after creation?”, type no and hit Enter key. 17. For OK?, type yes and hit Enter key. 18. Now you will be asked to add another user, type no and hit Enter key. 19. New user with sudo/admin rights have been created successfully.
  • 8. Note: “aaree” can be any username of your choice. 20. Now you will need to edit sudoers file to uncomment the line shown in screenshot below to give sudo rights to wheel group. For this, we will check /etc/sudoers file and see whether sudoers group is enabled or not. For this purpose, we will execute the following command. # visudo 21. After executing the above command, you will see the following lines in the opened file.
  • 9. Remove the # from its start to uncomment the line. Otherwise, your username will not be able to execute sudo command. To remove this, make your cursor on # and press r key and then press spacebar key. After it type :x and hit Enter key to save changes.. SUSE / OpenSUSE / CoreBSD: Note: Step 3 & 4 is not for CoreBSD. 1. To create a new user account, use the following command: # useradd aareez where “aareez” can be any username of your choice. 2. Now you will need to set password for your added username. To set password, execute the following commands: # passwd aareez Now set your desired password and retype your desired password, then hit Enter key. To confirm the data is correct, type ‘Y’ and hit Enter key. 3. Now assign username to sudo user’s group to give administrative privileges. For this, we will check /etc/sudoers file and see whether sudoers group is enabled or not. For this purpose, we will execute the following command. # visudo
  • 10. 4. After executing the above command, a file will be opened, find the following lines in the opened file. Sometimes by default the second line %wheel ALL=(ALL:ALL) ALL is commented (starting with hash #), due to which even after adding username to sudoers, it gives error on using sudo. To prevent this issue, if this line starts with ‘#’ sign, remove this symbol and save the changes by pressing Esc key, type :x and hit enter. 5. Now you will add your username “aareez” to the “wheel” group by executing the following command: # usermod -aG wheel aareez Your username has been successfully added to sudoers group and it is able to execute any root command. How to check to which group your username belongs? You can verify the membership for that group by executing the following command: # groups aareez
  • 11. How to switch from one user account to another? Now, log in by using your new username and password. OR Use the following command to switch user: # su - aareez How to check from which username you are logged in? You can see that you have been logged in from your new account now. If you want to verify this, you can use the command below: # whoami References [1] A. u. D. Shafiq, "Linux OS - Why is it better?," Learn Cybers, 13 10 2019. [Online]. Available: https://learncybers.com/linux-os-why-is-it-better/. [Accessed 13 10 2019].