Saturday, December 24, 2016

File Permissions and Access Rights 1

File Permissions and Access Rights 1

File and Directory Access Reviews

In UNIX, all kinds of system resources have the rights to read, write and execute on defined users and groups. The file attributes configuration determines who can read, write, and execute a resource.
 
By default, a user has all rights to all resources under his or her home directory.


A special UNIX user, 'root', has all rights over all system resources.






Above "ls -l" is shown where the owner of the file, the group, and the access authorities are located.

The first character on the left is the file type ("-" ordinary file, "l" link, "d" directory, etc.)


The next 3 characters are the access authority of the owner of the file

The following 3 characters are the access authority of the group of the file
The last 3 characters are the access authorities of the others

 
The * mark on the right side of the file names indicates that the file is executable by the current user. This is a feature of the ls program running under Linux.


As can be understood from the examples, there are three kinds of authority, and these authorities read, write and operate with the order.

If there is a letter in the authorization definition, the corresponding authorization is given. If there is a "-" sign, the authorization is not given.


When three of these definitions of authority come side by side, the authority of the owner, group and others of the file can be determined.


For example:"---------" means that no one has any authority"r --------" means that the owner only has the authority to read, the same group and others have no authority over the file"rw-rw-r--" means that the owner and the group have the authority to read and write, and others are only authorized to read"rwx-r-xr-x" indicates that the owner has read, write and execute authority, the group has authority to read and execute the group, and others have read and execute authority.


The writing authority defines the ability to make changes and delete at the same time. The person who is authorized to write to a file can be deleted.


Access to files and directories is regulated by the "chmod" command.

"chmod u+x hidden_file" - gives the right to run the "hidden_file" file. 


"chmod ug = rw important_file" - only the read and write authority is given to the owner and group of the "important_file" file, and the authority of the other does not change.

Multiple authorizations can be made at the same time, separated by commas.


"chmod ug+rw, ug-x, o-rwx bigfile" - the owner and group of the "bigfile" file are given read and write permissions, the owner of the file and its group are authorized to run, and no authority is given to the others.


The special powers of stick, setuid and setgid will be discussed later.


The access authority of the file can be given in octal numbers for chmod command.

You need to use 4 for "r", 2 for "w", 1 for "x" and finally 0 for "-". The figures corresponding to the authorities are written and collected in groups of 3. The 3-digit number is the number of authority.


For example:

"-rw-r-x---"        means (4+2+0) + (4+0+1) + (0+0+0) = 650
"-rwx-wx--x"     means (4+2+1) + (0+2+1) + (0+0+1) = 731
"-rwxrwxrwx"  means (4+2+1) + (4+2+1) + (4+2+1) = 777

We can change the access rights of any file by both following ways (they both mean the same):

chmod +rwx any_file.ext
chmod 777 any_file.ext

The permissions will be "-rwxrwxrwx".

To read my previous article: File and Directory Commands

Tuesday, December 6, 2016

File and Directory Commands

File and Directory Commands

UNIX Command Format

In UNIX, commands consist of a single word. The second word that comes next to the command is processed as a parameter. Example: "cd /home/user"

Options are given with the "-" sign. More than one option can be written to a command individually, or it can be written by a single "-" sign.
Example: "ls -l -a" and "ls -la" produce the same result.


The GNU version also supports long option input.
Example: "mail -h" and "mail --help" give the same output.


Option parameters are used immediately after the option with or without spaces. In the GNU version of the commands, the parameters of the long-style options are given after the "=" character after the option.

For example: "ls -w 160", "ls -w160" and "ls --width = 160" are the same. The parameter "-w" is "160".


The parameters of the commands are given after the options.
Example: "ls -w 160 directory1 directory2" The command parameters are "directory1" and "directory2".


To execute the commands at the same time on a single line, you can put a ";" between them.
Example: "configure; make; make install "


"&&" field means "and". If the command on the left is successful, the command on the right is executed, otherwise it is not.
Example: ls directory && cd directory


However, if the "ls" command lists the "directory" directory, it will run "cd directory". Any attempt to enter a non-existent directory will be blocked.

"||" field means "or". If the command on the left is successful, the command on the right is not executed.

Example: ls directory || mkdir directory

If the "ls" command can not list the "directory", the "directory" is defined with
"mkdir directory". The directory "directory" may be listed by "ls", but it will not be attempted to be defined with mkdir because the "directory" already exists.

mkdir (MaKe DIRectory) is used to create a new directory, rmdir (ReMove DIRectory) is used to delete an empty directory.
The command 'rm -rf directory_name' can be used to delete a content-rich directory with all content.


If the UNIX commands can run in error-free format, the user will not be informed that they have successfully run and finished. Feedback is given when an error occurs, only.



On older Linux systems, when running "rm -rf /" as root, all files are deleted from the system until there are no more files left. Current linux systems have been taken care of within the rm command This should be considered as a further indication of the need to work with root identity only when necessary.

Some useful commands combined with parameters:

touch <file_name>: It creates a file named "file_name", if it already exists then it updates the date modified.

rm <file_name>: Deletes file named "file_name".

rm -f <file_name>: Deletes file named "file_name" without asking permission.

rm -i <file_name>: Deletes file named "file_name" with asking permission.

rm -r <directory_name>: Deletes the directory and all the contents of it recursively.

rm -rf <directory_name>: Deletes the directory and all the contents of it recursively without asking permission.

In UNIX, there is no such thing as a file extension like Windows. A file name can have more than one dot ("."), Which is often used to make the file name more meaningful. Parts separated by periods, do not have to carry information about the format of the file.

For this reason, a file ending in ".txt" can be either an executable file or an image file.


Copy, Move and File Commands


The cp command is used to copy files and directories. Common forms of use are:

cp <source> <target>: copies the file/directory specified as "source" to the destination specified as "target"

cp -r <source> <target>: copy the source directory and all files and directories under it to the target directory. If target does not exist, creates it.

cp -r -p <source> <target>: copy the source directory and all files and directories under it to the directory target. If target does not exist, creates it. In addition, copy files and directories with protection of their access rights.

Mv <source> <target>: Moves the file/directory specified as "source" to the location specified as "target". This command is also used to change the file/directory name (mv <old_file_name> <new_file_name>).  

An existing file can be overwritten as a result of cp and mv operations. In some cases unwanted information loss may occur.

With the file command we have information about the type of file. Example:





Pattern Matching

In UNIX, pattern matching is a very useful and powerful feature. In many places it makes operations much easier.

* - replace any character string or nothing.


? - is used in place of any character. 

[] - The characters in the range are used instead of one character.

ls page * - fetch all the directories/files starting with "page" directory/file. 

ls page?.txt - fetch all directories/files starting with "page", continuing with any character and ending with ".txt". 
ls page??.txt - fetch all directories/files starting with "page", followed by any two characters and ending with ".txt".

ls page?[0-2].txt - Fetch all directories/files starting with "page", continuing with any character, continuing with 0, 1, 2 characters and ending with ".txt". 

ls page*[13579].txt - Fetch all directories/files starting with "page", followed by a single odd digit and ending with ".txt".


Example Usage of "file" Command

find /usr/include -name "stdio.h": Search for the file named "stdio.h" in the directory "/usr/include" and all directories under it.

find / home -name "*. [Ii] [Ss] [Oo]": Search all files in .iso, .iso, .iSo ... in all directories under /home.


find / -type l: search all link files from the root


find /home/user -user root: search the files owned by the root user in all directories under the /home/user directory.


find /home -uid 500: Looks for the files owned by the user with user id 500 in all directories below the /home directory.


find /home -size +2048M: Look for files larger than 2 GB in the /home directory and all directories under it.


find /home -size + 10240k: Look for files larger than 10MB in the /home directory and all directories under it.


find / -type f -mmin -90: Search for modified files in the last 90 minutes. 

find / -type f -mmin +90: Searches for files that have been "modified" before the last 90 minutes.

To read my previous article: Change of Active Identity and PAM

Sunday, December 4, 2016

Change of Active Identity and PAM

Change of Active Identity and PAM

Commands to Change the Active Identity

  • The su command is used to become another user during a login session. Invoked without a username, su defaults to becoming the superuser. The optional argument - may be used to provide an environment similar to what the user would expect had the user logged in directly.
  • The sudo command allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.
  • visudo edits the sudoers file in a safe fashion. visudo locks the sudoers file against multiple simultaneous edits, provides basic sanity checks, and checks for parse errors.  If the sudoers file is currently being edited you will receive a message to try again later.

PAM (Pluggable Authentication Module)

In the old times of Linux; When a program such as su, passwd, or login wants to authenticate a user, it simply reads the necessary information from the /etc/passwd file. It was enough to edit the file /etc/passwd to change the user's password. This simple but incompetent method confronted system administrators and application developers with problems.






MD5 and shaded passwords have become popular and it has become clear that every program that needs user authentication needs to know how to get the right information. If you want to change the user authentication credentials, you have to recompile all the programs.

PAM removed this complexity from possible security vulnerabilities in addition to programmers' ease of life, allowing programs to authenticate themselves in a transparent manner, independent of how user information is stored.

Today, software that requires user authentication can authenticate users through PAM without knowing the complexity of the user authentication mechanism. 

With PAM, users can be verified not only from the "/etc/passwd" file, but also from the database, directory server, fingerprint, etc. UNIX is very flexible in terms of the user authentication mechanism can be integrated with many different authentication systems.

Any software that uses the PAM application interface can benefit from the flexibility provided by PAM. There are many different PAM modules for Linux. There are already modules for Radius, LDAP, SmartCard, X.509 certificates.

PAM Configurations

The PAM configuration files are located in the /etc/pam.d/ directory. Although the files included in this directory vary according to the services and applications running on your system, you will see a file in this directory for each program that needs user authentication in your system. Each file in this directory contains the PAM authentication configuration for the respective program.


The configuration files have the following syntax:
type control module-path module-arguments
 


  • type: specifies which type of authentication to perform. Account, auth, password, session
  • control: specifies what to do if the proof fails. Requisite, required, sufficent, optional
  • module-path: specifies which module to use and where.
  • module-arguments: parameters to be added to the module.
The type attribute tells PAM what type of authentication to use for this module. PAM identifies four different types: Account determines whether the user is allowed to access the service, whether the password expires or not. Auth controls whether a user is a claimed user, usually by a password. Password provides a mechanism for the user to change the password used for authentication. Session what to do after the user has been authenticated and / or done before. These could be things like connecting / unlocking the home directory of the user, keeping a record of the sessions that you turned on and off, and restricting the services that the user could use.

We see in the login configuration file that there is at least one entry for each type, but all are there because login is above the entire user structure. You can not see the whole thing in customized services.

Control tells PAM what to do when a module fails authentication. PAM recognizes four different types of control: Requisite if authentication fails through this module, the authentication is immediately rejected. Required PAM continues to call other modules listed for this service before rejecting authentication, but failure also results in denial of authentication. Sufficient if authentication with this module succeeds, PAM will accept authentication even if it fails in a previous required module. Optional the success or failure of this module is important if it is the only module in its kind for a service. Module-path knows which module PAM will use and where to find the modules.


To read my previous article: Monitoring of Work

 

Monitoring of Work

Monitoring of Work

The groupadd command is used to create a new working group and the groupdel command is used to delete an existing working group.

The gpasswd command is used to add or remove a user to a particular working group.

  • "gpasswd -a <user><group>" adds user to the group
  • "gpasswd -d <user><group>" removes user from the group
Although the user is a member of more than one group, he or she can only work as a member of a group.
 

It is possible for the user to use the id and groups programs to query the active user and group IDs.
 

The newgrp program must be used to change the active group.
  • id - print real and effective user and group IDs
  • groups - print the groups a user is in
  • newgrp <newgroup> - allows the user to change the active group identity to another group that he or she is a member of.
  • newgrp - allows the user to change the active group identity as his or her main group. 
Users can only operate as a member of one group at any time.
 
The user is able to monitor the working user and group identity and change the active group membership via the id and newgrp commands.


It was previously stated that the UNIX operating system is a multi-user system. There are several commands in UNIX to monitor other users who are actively using the system at any given time.





who - lists the users working on the system, along with the system entry times. 

w - lists the users running on the system and which programs they are running.

whoami - shows you which user ID you are using and when you log in.



In all command outputs, PTSs mean pseudo terminals (virtual terminals). This indicates that the user is not using a cable-connected terminal directly. pts/0 is the first virtual terminal and pts/1 is the second virtual terminal.

Password and shell change

The user changes his/her password with the "passwd" program. If the password is not complicated enough, "passwd" will alert the user. For security reasons, the old password is asked once and the new password is asked twice.

The user can change the used shell with the "chsh" program. The list of existing shells is also written in the file "/etc/shells". With "chsh", only the shells written in this file are allowed to be used. User is asked for password for security reasons before shell change.

To read my previous article: User Concept and User Groups

Friday, December 2, 2016

User Concept and User Groups

User Concept and User Groups

The UNIX operating system is a multi-user operating system. Every real person who makes use of the system has a "user account" and a "user ID" defined on the system. The user ID is used for the authorization of the users (who is authorized for which transaction) and transaction records (who made what transaction when).

Users log in to UNIX systems with their usernames and passwords. The operating system asks for the username and password of the user requesting the login, and compares these two entries with the user authentication system and confirms or rejects the user's login.

Each user has a user number (user ID) assigned by the operating system. Any user's actions on the system are followed by this user number. During user identification, this number is automatically selected and assigned by the system if the system administrator does not specifically select a user number.

File, directory and device access controls are made with the user number. In UNIX context, there is a proprietor of all sorts of resources and ownership information is structured by user numbers.

"root" User





'Root' refers to the most authoritative user of the system and the owner of all the files.

The 'root' user owns all rights to the files and directories of the system. You should never be logged in as 'root' because it is not possible to recover from accidental changes. You must have root privileges by entering the password with the command su - (switch user) when necessary during operation.

The user number of the 'root' user is '0'. It is sufficient for the user number of that user to be changed to "0" in the /etc/passwd file so that a registered user on the system has the same rights as root. In this case, this user will have all rights over the system without using the 'su' command.

There are also a number of special users to run system services outside of root. The user shell of these users is defined as /sbin/nologin and it is not possible to access the system with username/password mapping.

User Groups

UNIX has user groups. UNIX users are members of these groups. Groups are treated as a group ID (gid) in UNIX in a manner similar to user identities in UNIX. Computer resources also have group access rights. It is possible to give a gratuity to the right of access to a resource on this account.

The group ID of each user in the /etc/passwd file is the identity of the primary group that the user is a member of.

Users can also be a member of other groups from their main group. Other groups where the user is a member are kept in the /etc/group file.

Group information is kept in / etc / group file. Each line of the / etc / group file has the following format:

group_name:group_password:gid:user1,user2,user3

The last section in this line is given in the form of a list of members of the group "user1, user2, user3".

To read my previous article: Manual Pages and Communication Commands
 

Thursday, December 1, 2016

Manual Pages and Communication Commands

Manual Pages and Communication Commands

Online Manual Pages

The online guide pages library should be installed with every UNIX variant, unless an option is entered otherwise. The guide pages are usually located under the /usr/share/man/ directory and are prompted as "man <command_name>".

You can use 'F' to go forward one page, 'B' to go backward one page, 'Return' to read line by line, and 'Q' to exit the grid from an online guide page.

Multiple manual pages related to a keyword may be encountered while accessing the manual pages. For example, there are pages in both the first section and the second section regarding the time word. The man program may be displaying the first one it finds in such cases or both in order. The manual pages can be viewed in the "man 2 time" format by first giving the manual section followed by the keyword.

Communication Commands

The "mesg y" command can be run to accept messages from other users. The "mesg n" command closes the message communication channel. If this command is given, no message will be accepted from other users in the system.

With the "write user_name" command, a message can be sent to the user who has logged in to the system at that time. To send a message to an uninitiated user, an e-mail can be sent with the command "mail user_name".

After the "write user_name" command is issued, the message to be transmitted can be written. The "Ctrl + D" key combination can be used to end the message application.

With the "wall" command, messages can be sent to all users who have logged in to the system at that time.

After the "wall" command is issued, the message to be transmitted can be written. The "Ctrl + D" key combination can be used to end the message application.

/etc/motd

When users log on, the "/etc/motd" file is displayed. By submitting announcement messages to this file, you can make sure everyone who logs in to the system can see the message (motd = Message Of The Day).

To read my previous article: Interaction with Linux - Shells
 

Interaction with Linux: Shells

Interaction with Linux: Shells

Shell is the interface software between the user and the operating system kernel. The user passes all commands to the operating system via the shell.

The shell program is intended to receive the user's commands and pass them to the operating system. An interface program controlled by the mouse can be used as the shell program. The essential mission is to allow the user to express his wishes. 

Under UNIX, there are many different shell programs for general and special purposes. Bash, ksh, and csh are among the more common general-purpose shell programs. The main difference between these programs is their syntax. In this sense, it can be argued that the shell programs allowed communication with different languages. 

Each user may be using a different shell program. User shells are defined in the /etc/passwd file. 

The most commonly used shell program under Linux is Bash (Bourne Again Shell). This shell, which is preferred due to its advanced features and ease of use, will be examined in more detail as a separate article.

Login and Logout to the System

A computer system running a UNIX operating system can be accessed via the computer's keyboard and screen, or if the computer system provides telnet and/or ssh services, it can also be accessed over the network.

When logged into the system, the shell program satisfies the user and prompts the user to issue commands. The commands issued by the user are executed via the shell.

There is no difference between local access and remote access to a UNIX system. All operations, which can be done in local access and does not require physical action (pressing the power button to open a closing system, etc) can be done remotely.

Users have to inform the system that they are finished using the system. Otherwise the connections will remain open. Exit or logout commands are used at the exit from the system.

New versions of many Linux distributions, if installed with graphical interface support, can meet the user with a graphical user interface rather than text mode.

System Access and Virtual Consoles

On UNIX systems, the system-connected keyboard and display are called "consoles". Each UNIX system has only one console.

Under Linux, "virtual consoles" have been defined to make it easier for users to work through the console. Virtual consoles offer the infrastructure to allow parallel operation even across multiple screens, even when using the same keyboard and screen. For example six Red Hat Linux virtual consoles come pre-defined.

In Linux, Alt + FX key combination can be used to switch between virtual consoles. In this context, Alt + F1 allows the first virtual console, Alt + F3 to pass the third virtual console.

On a Linux system predefined by xwindows, the CTRL + ALT + FX key combination is used to access the console. In this context, CTRL + ALT + F1 allows the first virtual console, CTRL + ALT + F3 to switch to the third virtual console.

Use the Alt + F7 key combination to return to xwindows while in the virtual console.
 
 
 


To read my previous article: File Hierarchy and Home Directory


 

Wednesday, November 30, 2016

File Hierarchy and Home Directory

File Hierarchy and Home Directory

Directory Structure

In UNIX, all directories are sorted in a hierarchical structure based on the root "/". Unlike UNIX, in MS-DOS and MS-Windows, the directory structure is a separate tree structure for each "drive" (C: driver and its directories, D: driver and its directories, etc.). The symbol used between directories is the '/' (slash) symbol; MS-Dos and MS-Windows use the '\' (backslash) symbol. In this context, "/home/file1" refers to a valid directory and the file1 object located under the home directory under the root directory.





The image above shows basically visualization of the file system hierarchy in Linux.

The /boot directory contains data about linux boot for instance; initrd, vmlinuz. All the configuration files are located in the /etc directory. The directory of /home contains users' home directories. /dev is the directory where the devices in the linux system is located. /tmp is the common write area, every user can write, but nobody can delete anyone's file. /proc is the directory where statistical information about the system can be queried (eg cat /proc/cpuinfo). There are mainly libraries in /var and there are binaries of basic commands in /bin directory.

Home Directory

Each user has his own home directory on the system. User's personal files and user specific configuration files are stored under this directory. The home directory can not be accessed by anyone other than the user and the system administrator unless the user specifically permits it. 

Traditionally, file and directory access control rules are not applied to the system administrator on a UNIX operating system. The system administrator can access the desired file and directory as desired.

Under Linux the predefined home directories are under the /home directory. Unless otherwise specified by the system administrator, a subdirectory is created under the /home directory for each newly defined user. In this context, wwalter is created in the /home/wwalter path of the home directory defined for this user after the user is identified. When the user logs in the system starts working under the home directory.

The system automatically creates the directory as /home/username if it is not entered as a parameter during user addition.
  
Predefined users can not register data in any directory other than the home directory and the /tmp directory, which is defined as the temporary use directory. Software executed by all users and users can save their temporary files to this directory.

Users which there is not enough space in the home directory or users who doesn't want to "pollute" the home directory can save their temporary files in the /tmp directory. This directory is usually cleaned by the system administrator to free up space for new files at regular intervals. So it is not possible to use the /tmp directory for persistent storage.

To read my previous article: User Concept and User Groups 

User Concept in UNIX and Linux

User Concept in UNIX and Linux

How to Choose a Username and Password

User names must be chosen to consist of the English alphabet letters (a-z, A-Z) and numbers (0-9). The letters used in other alphabets should not be used in user names; Those letters are not accepted by many Linux distributions and other UNIX variants.

It is preferred that the usernames are selected in a manner that will generally invoke the user's real name. Only names, only surnames or suffixes, are common username alternatives.

User passwords must be chosen so complex that they can not be easily guessed by anyone other than the user. Since the checking of the user identity is performed only on a password basis, the password must not be known by anyone other than the user himself or herself.

It is recommended that an active password be at least six letters long and consist of a combination of letters, numbers and punctuation marks. Since the password is based on confidentiality, it must not be stored in paper form or any electronic form.

User names and passwords are case sensitive. In this sense, "wwalter" and "WWalter" are perceived as two different user names.

Criteria for a Good Password 

A good password must be:
  • at least 8 characters long
  • too complex to predict
  • simple enough to remember
  • contain at least one case difference
  • contain at least one digit (0-9)
  • contain at least one punctuation mark
  • not contain repetitive numbers or characters 
Periodically, you should change your password regularly. Many system users are forced to change their passwords every 3 months or 6 months (For example banks). 

User Definition File

Traditionally all UNIX settings are stored in text files, this tradition continues under Linux as well. Storing all settings in text files allows all settings to be made with text editors. Any programmer can easily make maintenance tasks by quickly creating programs to organize settings in text files.

 The basic user authentication information is kept in the file /etc/passwd. In this file, each row represents one user: User name, password, user id, group number, personal information (For example; name, surname or phone number), home directory and user shell.  

Example format:

  •  username:password:user_id:group_id:additional_info:home_directory:shell

To improve security in modern UNIX variants, encrypted user passwords are kept in the /etc/shadow file, not in the /etc/passwd file. The passwords appear as "x" in the /etc/passwd file. The /etc/shadow file can only be read and written by the system administrator, in other words, "root".


To read my previous article: Free Software Philosophy GPL and BSD

 

Tuesday, November 29, 2016

Free Software Philosophy GPL and BSD

Free Software Philosophy GPL and BSD

Richard Stallman and GPL

Richard Stallman, who worked as a researcher in the artificial intelligence lab at MIT in 1984, has set out the philosophy of free software and he has brought the philosophy and products in a place where they are today with the support he found. Stallman's starting point was a contradiction between the way scientific development is achieved and the production and development of industrial computer software.

Scientific innovation is only possible through the sharing of inventions, experiences and all other conclusions of academic researchers with the public. These scholarly publications, where all details are shared, allow an investigator to conduct studies that may be the continuation of previous researchers' work. If this sharing were not so clear and widespread, the pace of scientific progress and the level of our society today would be much lower.

Stallman also implements the Free Software Foundation (FSF), which foresees that software must be "free" and distributed freely and with all the details (source code, etc.). The GNU General Public License (GPL) is intended to promote and use the software license. This license is a license that allows software to be freely distributed and to make the software public domain.

The FSF has adopted the goal of producing a "free operating system" consisting entirely of free software components. All critical components, including text editor, kernel, compiler, etc. has been developed or is being developed by the FSF.  

 BSD License

UNIX is being developed at AT&T Bell Laboratories. After the division of AT&T, AT&T, the proprietor of UNIX, announces that they abandoned to distribute UNIX freely (while the operating system is initially distributed free to all clients) and plans to sell the software for a license fee,  resembling the definition of "free software".


Until then, the academic environment that uses UNIX and contributes to its development is not delayed in finding its own way out. A group of developers from Berkeley pick up UNIX from where AT&T left off free distribution and continue to produce and distribute a free UNIX with the support of other contributors. From this point on, UNIX is divided into two main branches; "AT&T UNIX" and "BSD UNIX".

BSD UNIX is distributed under the "BSD Software License". This license is a more liberal license than the GPL. The BSD license defines the software literally as "fountain". The software is free to use, as you wish. The condition of sharing the changes made with the public of GPL License is not subject to the BSD license. The person receiving the software can do whatever they want and does not have to share what they do with others.

Today, many popular software are distributed under the BSD license. The Apache web server is distributed under a BSD license and many vendors (Oracle, IBM, etc.) re-name Apache as their web server.

BSD UNIX, which was discontinued to develop by Berkeley in the mid-90s, was later broken down into many branches. Each of these branches (FreeBSD, OpenBSD, NetBSD) is still being maintained and distributed under the BSD license.

To read my previous article: What is Unix and Linux ?

 

Monday, November 28, 2016

What is Unix and Linux ?

What is Unix and Linux ?

What is an operating system ?

An operating system is a system software who is responsible for direct inspection and management of computer hardware and running application programs. Operating systems enable all other software to access memory, I/O devices, etc.

Kernel can be considered as brain of an operating system. Existing of an operating system without a kernel is impossible. All the other programs communicate via kernel. Kernel gains value when it becomes together with other programs. It enables programs to communicate with hardware and other programs uniformly, which means independent from hardware and software.

One of the most interesting examples of operating systems is Debian GNU/Linux. Currently, Debian is composed of Linux kernel and GNU tools, but now it is being updated in such a way that it could run on Hurd kernel. Main purpose of the Debian team is to prepare an operating system which provides users the opportunity of running the same GNU tools on different kernel alternatives.

What is UNIX ?

In 60's and 70's, there were operating systems which are developed for a specific computer in assembly language. For every new computer system, a new operating system was being developed in order to make users benefit from computers in a more comfortable manner.

Only a little part of the UNIX was developed in assembly language. It was developed in late 60's. Major part of the operating system was developed in C language which is also developed in almost the same years. Developing an operating system in a high-level language like C compared to assembly, provided computer manufacturers with the mobility, which means moving UNIX in their computer systems. So, it was a major technological improvement.

Application programming interface (API) which is provided with UNIX, enabled all the applications to be developed without any problem on all UNIX systems. An application that is developed for one UNIX can be transferred to other UNIX systems using re-compiling without any problem.

Properties of UNIX

Multi-tasking

It is the ability of running more than one task concurrently. Multiple tasks can be run in parallel if there are multiple CPU's or they can be run as if they are parallel if there is one CPU. For example, while working with a word processor like WPS Writer, it is possible to back-up the disk.

Multi-user

It means multiple users can use a computer system concurrently. For example, while a user is watching a movie, other one can surf on the web.

Time Sharing

Thanks to this feature, all the jobs on the system can be maintained even if a computer has only a single CPU. Every user has a priority on the system and the time taken  from CPU to processes for those users is assigned according to those priorities. Super user can change the priority of the users and tasks.

Portability

It is the ability to move to a computer system with a different architecture with only a little change in the code. This broad compatibility allows architecture dependency to be reduced and variety to be increased.

High Performance

In the UNIX world which simplicity is preferred over visuality, many applications can be run with a better performance. Even though it is an operating system that is developed in the early 70's it is preferred by most companies on critical duties.


What is Linux ?

Linux is manifested as a result of experiments of a second year student at University of Finland, whose name is Linus Torvalds. He has done his work on a computer system based on a Intel 80386 architecture. Linux has tried to make his computer to open without an operating system and make it run applications. 0.02 version which is the first product of Linus is completed in 1991. Linus has attended a lecture whose topic was MINIX and he decided to create a better operating system than it. His message which is sent to internet groups, attracted a lot of attention and gained support. Volunteers who supported Linus and his project which is called 'Linux' has contributed it to become real.

Linux is distributed under GNU General Public License which enables its source code to belong everyone and open to every person. Linux is only a kernel of an operating system and it becomes meaningful with other free software which makes it useful.

Message from Linus

From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)
Newsgroups: comp.os.minix
Subject: What would you like to see most in minix?
Summary: small poll for my new operating system
Message-ID: <1991Aug25.205708.9541@klaava.Helsinki.FI
Date: 25 Aug 91 20:57:08 GMT
Organization: University of Helsinki
Hello everybody out there using minix -
I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing
since april, and is starting to get ready. I'd like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same
physical layout of the file-system (due to practical reasons) among other things). I've currently ported bash(1.08) and gcc(1.40),and
things seem to work.This implies that I'll get something practical within a few months, andI'd like to know what features most people would
want.
Any suggestions are welcome, but I won't promise I'll implement them :-)
Linus (torvalds@kruuna.helsinki.fi)
PS. Yes - it's free of any minix code, and it has a multi-threaded fs. It is NOT protable (uses 386 task switching etc), and it probably never will
support anything other than AT-harddisks, as that's all I have :-(

Properties of Linux

The most important feature of Linux is it belongs to public. Corporations that want to use Linux don't have to pay any license fees. Even if people and companies who contributed to development of Linux give up some day, other volunteers can continue developing it as long as it belongs to public. That way, dangers like producer changing the strategy, end the product or offering severe conditions after creating a product dependency are eliminated.

Source code of the system is open for anyone who wants to view and modify. Any person who wants to view, download, modify or distribute the modified version can reach the source code from here. Because of source code is open like this, it is very easy to trace and find the bugs. If we think there are thousands of people viewing the source code, we can understand how easy it is to find a bug in the code.

Another advantage of having the source code open is that new features can easily be added and the corporations can meet their unique expectations.

Apart from the addition of the new feature, the system can be shaped according to the sub-level settings and it is possible to disable unnecessary parts. Thus, a system suitable for the job can be obtained.

Linux can be run on different hardware platforms like HP-Compaq Alpha, Sun Sparc ve UltraSparc, Motorola PowerPC and StrongARM in the same way. An application that is running on a specific architecture can be moved to another Linux without any problems.  For example, if the server used for Intel Pentium architecture is insufficient a migration is possible to an IBM with many PowerPC processors, or a Sun computer system with a number of UltraSparc processors. Re-compilation of applications on new architectures is enough for this process.

Linux is in great harmony with other UNIX variants. Linux environment which has the features of both AT&T and BSD, has the ability to run other UNIX applications on itself. In this case, for example, an application developed on Sun Solaris systems can be re-compiled and run on Linux almost without change.



Linux Distributions

The software, which basically uses the Linux kernel and is bundled with the kernel, is called the Linux distribution as a whole. There are many companies and / or non-governmental organizations that prepare paid and free Linux distributions. 


Distributions can be used to make changes to the settings of the Linux kernel,
applying custom patches with preferences, and putting different free software into the distribution package. To differentiate, placing commercial licensed applications in the package, offering paid technical support and putting local language support at the forefront is another way to go.


RedHat, Ubuntu, Suse, Debian GNU / Linux and TurboLinux are Linux distributions, all showing differences with the qualities summarized in the previous paragraphs, despite having the same kernel (Linux) at the core.



Comments system

Disqus Shortname