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