Introduction to Linux
Linux is an
operating system that works just like Windows and Mac OS X. As an operating
system, Linux is a very hands-on operating system. If running Windows is like
driving an automatic, then running Linux is like driving a stick. It can take
some work, but once you know your way around Linux, you’ll be using the command
line and installing packages like a pro.
Note
Everything
on a Linux system is case-sensitive. That means that photo.jpg, photo.JPG, and Photo.jpg are all different files.
Usernames and passwords are also case-sensitive.
We’ll mostly be using the terms terminal, shell,
and SSH to refer to the interface you use to send text
commands to your Linux system. These are different tools that layer on top of
each other to let you interact with your server. To learn more, read these
simplified definitions:
- Terminal: A device that enters data into
and displays data from a computer. The terminal has the most direct access
to the operating system. Technically, most terminals these days are
actually terminal emulators that run as software on Mac
OS X, Linux, or Windows computers.
- Shell: A program that provides a user
interface for interacting with an operating system. There are different
types of shells, but the one we’re using here is called Bash and
provides a command-line interface that accepts and outputs text.
- SSH: A protocol that lets you send
shell commands to your Linode securely over the Internet.
Linux Directory Structure:-
The Shell
In
a Linux system, the shell is
a command-line interface that interprets a user's commands and script files,
and tells the server's operating system what to do with them. There are several
shells that are widely used, such as Bourne
shell (
sh
) and C shell (csh
). Each shell has its
own feature set and intricacies, regarding how commands are interpreted, but
they all feature input and output redirection, variables, and
condition-testing, among other things.
This
tutorial was written using the Bourne-Again
shell, usually referred to as
bash
, which is the default
shell for most Linux distributions, including Ubuntu, CentOS, and RedHat.
/etc/passwd file in Linux
Explained with Examples
Learning the /etc/passwd file is the essential
requirement of Linux user management. Learn why /etc/passwd file is used, what
is stored in it and how it is formatted in detail with examples.
The /etc/passwd file
is stored in /etc directory. To view it, we can use any
regular file viewer command such as cat, less, more, etc.
Each line in /etc/passwd file
represents an individual user account and contains following seven fields
separated by colons (:).
- Username
or login name
- Encrypted
password
- User ID
- Group ID
- User
description
- User’s
home directory
- User’s
login shell
/etc/shadow file in Linux Explained
with Examples
Historically, the /etc/passwd file used to store
all login information in a standalone Linux system. Later, due to following
reasons password information was moved in /etc/shadow file.
·
The /etc/passwd file has only one
field for password information. Since there is only one field, besides
encrypted password other password related information cannot be stored in this
file.
·
For
password encryption, the /etc/passwd file supports basic
algorithm such as DES. A hacker can easily reveal a password encrypted with DES
algorithm.
·
The /etc/passwd file is world readable.
It means any local user can view the passwords stored in this file.
·
The
/etc/shadow file addresses all above issues.
·
The /etc/shadow file has nine
fields to store encrypted password and other password related information.
·
The /etc/shadow file supports all
advanced algorithms and has plenty of room for further updates.
·
The /etc/shadow file is readable
only by root user.
Each line in /etc/shadow file represents an
individual user account and contains following nine fields separated by colons
(:).
- Username
- Encrypted
password
- Date of
last password change
- Minimum
required days between password changes
- Maximum
allowed days between password changes
- Number of
days in advance to display password expiration message
- Number of
days after password expiration to disable the account
- Account
expiration date
- Reserve
field
What is Swap Space?
Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.
Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.
Recommended System Swap Space
Amount of RAM in the system | Recommended swap space | Recommended swap space if allowing for hibernation |
---|---|---|
⩽ 2 GB | 2 times the amount of RAM | 3 times the amount of RAM |
> 2 GB – 8 GB | Equal to the amount of RAM | 2 times the amount of RAM |
> 8 GB – 64 GB | At least 4 GB | 1.5 times the amount of RAM |
> 64 GB | At least 4 GB | Hibernation not recommended |
What is LDAP?
The Lightweight Directory Access Protocol is a set of open protocols used to access centrally stored information over a network. It is based on the X.500 standard for directory sharing, but is less complex and resource-intensive. For this reason, LDAP is sometimes referred to as "X.500 Lite." The X.500 standard is a directory that contains hierarchical and categorized information, which could include information such as names, addresses, and phone numbers.
Why use LDAP?
The main benefit of using LDAP is that information for an entire organization can be consolidated into a central repository. For example, rather than managing user lists for each group within an organization, LDAP can be used as a central directory accessible from anywhere on the network. And because LDAP supports Transport Layer Security (TLS), sensitive data can be protected from prying eyes.