Free as in Beer Free as in Speech
Linux is a beautiful operating system. This article has given birth to a lot of children which will be introduced each week.
Configuration
Linux server is by far one of the most popular servers on the internet, at least 80% of public servers are running one flavor of Linux. Linux is an OS just like apple and windows, the difference is it’s free.
Free as in beer - Money, when someone buys you a drink, it didn’t cost you money because someone paid for you or is allowing you have it for free. In Linux you can use it for free, you do not pay money to get, install and use the software, but you can’t see the underlined source code or modify it for your own purpose.
Free as in speech - This means that you can do almost anything with the software, see the code, build on it, remove bugs, create your own software from it etc. Free as in speech has given birth to a lot of Linux distribution
Choice
Due to the numerous Linux distributions, I'll say Comparing distributions and making a choice is a unique skill. How do you make the write choice for your server, Red heart is an enterprise edition, it is not free as in beer companies pay for licence and receive support from red heart. Ubuntu has various versions and receive update constantly, that’s how it differs from Debian. Linux mint is often used by desktop users, while CoreOs is often used by companies building clusters and containers of application.
Structure
If you’re coming from Windows, the Linux file system structure can seem particularly alien. The C:\ drive and drive letters are gone, replaced by a / and cryptic-sounding directories, most of which have three letter names.
Working directory,
pwd
is used to check the current location in your machine
ls
is used to show files
ls -a
shows both hidden files
ls -al
shows all files both hidden with more information
Let’s just focus on the first characters for now, if it starts with a d
then its a directory, if it starts with a -
then it’s a file and if it starts with a .
than it’s a hidden file
- Directories ( ., .., .android, Android )
- Files (ACCC4CF8.asc)
- Hidden files and directories (., .., .android)
ls
is located in the bin
folder, but to use it we don't have to navigate into the bin folder, the command is accessible globally because the bin folder where it is located is included in the system path.
/etc
- configuration files, database modification, your web application will make some changes to this file
/var
- variable files, files that you expect to grow and change in time, you find applications
/bin
- executable binaries executed by all, applications that you run. The binaries here are required for boot and system maintenance processing./sbin
- binaries used only by root user for system administration and maintenance
/lib
- libraries located around the system
/usr
- user programs
Security
The Rule of Least privilege
This simply means that a user or application has a privilege just to do it’s job
Since every Linux user has a user root
with administrative privileges, root can do anything, we can disable the ability to login remotely as root and only login as a user we created. This is to make any potential attackers job a little bit difficult by disabling the default name they know.
su vs sudo.
Donot use the su command, we already talked about the rule of least privilege. The su command will switch your entire working directory to the root user, this could be very dangerous if you forget. It’s not ideal to switch your entire working directory just to run a simple command. Not everyone has the ability to work as the super user, you could do alot of damage, and no warning signs. With sudo you can run commands as though you were the root user
Software installation: just like in other operating systems where you can download a software from appstore or buy a physical copy, in Linux we have what we call the package source list
, this is where all available softwares are listed
To view them
cat /etc/apt/sources.list
To keep your system secure, one way is to make sure your system is up to date with new releases. The first thing to update your software, is to update your software source list
sudo apt-get update
We added sudo there, because we have to run the command as a root user. The sudo apt-get update
command does not update the software itself, it updates the repositories from where your software was installed.
sudo apt-get upgrade
This command updates the software to another version available
sudo apt-get autoremove
This command checks for softwares that are no longer in use and can be removed To install a new package or software
sudo apt-get install finger
In the example above finger is the package name, each distribution publishes an easy to browse version of all packages available. In Ubuntu we have a website called packages.ubuntu.com
where you find all packages names.
Finger is a package used to display information about a user, go ahead and type
finger
In the next article we will talk about user management
, sudoers
, resetting passwords
, authentication
, public key installation and encryption
, etc.