Theory - 4 :- Basic File Permissions in Linux

 1. File Permissions

As we learned previously, files have different permissions or file modes. Let's look at an example:

$ ls -l Desktop/


drwxr-xr-x 2 pete penguins 4096 Dec 1 11:45 .

 

There are four parts to a file's permissions. The first part is the filetype, which is denoted by the first character in the permissions, in our case since we are looking at a directory it shows d for the filetype. Most commonly you will see a - for a regular file.

The next three parts of the file mode are the actual permissions. The permissions are grouped into 3 bits each. The first 3 bits are user permissions, then group permissions and then other permissions. I've added the pipe to make it easier to differentiate.

d | rwx | r-x | r-x

Each character represent a different permission:

  • r: readable
  • w: writable
  • x: executable (basically an executable program)
  • -: empty

So in the above example, we see that the user pete has read, write and execute permissions on the file. The group penguins has read and execute permissions. And finally, the other users (everyone else) has read and execute permissions.

 

2. Modifying Permissions

Changing permissions can easily be done with the chmod command.

First, pick which permission set you want to change, user, group or other. You can add or remove permissions with a + or -, let's look at some examples.

Adding permission bit on a file

$ chmod u+x myfile

The above command reads like this: change permission on myfile by adding executable permission bit on the user set. So now the user has executable permission on this file!

Removing permission bit on a file

$ chmod u-x myfile

Adding multiple permission bits on a file

$ chmod ug+w

There is another way to change permissions using numerical format. This method allows you to change permissions all at once. Instead of using r, w, or x to represent permissions, you'll use a numerical representation for a single permission set. So no need to specify the group with g or the user with u.

The numerical representations are seen below:

  • 4: read permission
  • 2: write permission
  • 1: execute permission

Let's look at an example:

$ chmod 755 myfile

Can you guess what permissions we are giving this file? Let's break this down, so now 755 covers the permissions for all sets. The first number (7) represents user permissions, the second number (5) represents group permissions and the last 5 represents other permissions.

Wait a minute, 7 and 5 weren't listed above, where are we getting these numbers? Remember we are combining all the permissions into one number now, so you'll have to get some math involved.

7 = 4 + 2 + 1, so 7 is the user permissions and it has read, write and execute permissions

5 = 4 + 1, the group has read and execute permissions

5 = 4 +1, and all other users have read and execute permissions

One thing to note: it's not a great idea to be changing permissions nilly willy, you could potentially expose a sensitive file for everyone to modify, however many times you legitimately want to change permissions, just take precaution when using the chmod command.

3. Ownership Permissions

In addition to modifying permissions on files, you can also modify the group and user ownership of the file as well.

Modify user ownership

$ sudo chown patty myfile

This command will set the owner of myfile to patty.

Modify group ownership

$ sudo chgrp whales myfile

This command will set the group of myfile to whales.

Modify both user and group ownership at the same time
If you add a colon and groupname after the user you can set both the user and group at the same time.

$ sudo chown patty:whales myfile

4. Umask

Every file that gets created comes with a default set of permissions. If you ever wanted to change that default set of permissions, you can do so with the umask command. This command takes the 3 bit permission set we see in numerical permissions.

Instead of adding these permissions though, umask takes away these permissions.

$ umask 021

In the above example, we are stating that we want the default permissions of new files to allow users access to everything, but for groups we want to take away their write permission and for others we want to take away their executable permission. The default umask on most distributions is 022, meaning all user access, but no write access for group and other users.

When you run the umask command it will give that default set of permissions on any new file you make. However, if you want it to persist you'll have to modify your startup file (.profile), but we'll discuss that in a later lesson.

5. Setuid

There are many cases in which normal users need elevated access to do stuff. The system administrator can't always be there to enter in a root password every time a user needed access to a protected file, so there are special file permission bits to allow this behavior. The Set User ID (SUID) allows a user to run a program as the owner of the program file rather than as themselves.

Let's look at an example:

Let's say I want to change my password, simple right? I just use the passwd command:

$ passwd

What is the password command doing? It's modifying a couple of files, but most importantly it's modifying the /etc/shadow file. Let's look at that file for a second:

$ ls -l /etc/shadow
 
 

-rw-r----- 1 root shadow 1134 Dec 1 11:45 /etc/shadow

 

Oh wait a minute here, this file is owned by root? How is it possible that we are able to modify a file owned by root?

Let's look at another permission set, this time of the command we ran:

$ ls -l /usr/bin/passwd
 
 

-rwsr-xr-x 1 root root 47032 Dec 1 11:45 /usr/bin/passwd

 

You'll notice a new permission bit here s. This permission bit is the SUID, when a file has this permission set, it allows the users who launched the program to get the file owner's permission as well as execution permission, in this case root. So essentially while a user is running the password command, they are running as root.

That's why we are able to access a protected file like /etc/shadow when we run the passwd command. Now if you removed that bit, you would see that you will not be able to modify /etc/shadow and therefore change your password.

Modifying SUID

Just like regular permissions there are two ways to modify SUID permissions.

Symbolic way:

$ sudo chmod u+s myfile

Numerical way:

 sudo chmod 4755 myfile

As you can see the SUID is denoted by a 4 and pre-pended to the permission set. You may see the SUID denoted as a capital S this means that it still does the same thing, but it does not have execute permissions.

6. Setgid

Similar to the set user ID permission bit, there is a set group ID (SGID) permission bit. This bit allows a program to run as if it was a member of that group.

Let's look at one example:

$ ls -l /usr/bin/wall

-rwxr-sr-x 1 root tty 19024 Dec 14 11:45 /usr/bin/wall
 

We can see now that the permission bit is in the group permission set.

Modifying SGID

$ sudo chmod g+s myfile

$ sudo chmod 2555 myfile
 

The numerical representation for SGID is 2.

 

7. Process Permissions

Let's segue into process permissions for a bit, remember how I told you that when you run the passwd command with the SUID permission bit enabled you will run the program as root? That is true, however does that mean since you are temporarily root you can modify other user's passwords? Nope fortunately not!

This is because of the many UIDs that Linux implements. There are three UIDS associated with every process:

When you launch a process, it runs with the same permissions as the user or group that ran it, this is known as an effective user ID. This UID is used to grant access rights to a process. So naturally if Bob ran the touch command, the process would run as him and any files he created would be under his ownership.

There is another UID, called the real user ID this is the ID of the user that launched the process. These are used to track down who the user who launched the process is.

One last UID is the saved user ID, this allows a process to switch between the effective UID and real UID, vice versa. This is useful because we don't want our process to run with elevated privileges all the time, it's just good practice to use special privileges at specific times.

Now let's piece these all together by looking at the passwd command once more.

When running the passwd command, your effective UID is your user ID, let's say its 500 for now. Oh but wait, remember the passwd command has the SUID permission enabled. So when you run it, your effective UID is now 0 (0 is the UID of root). Now this program can access files as root.

Let's say you get a little taste of power and you want to modify Sally's password, Sally has a UID of 600. Well you'll be out of luck, fortunately the process also has your real UID in this case 500. It knows that your UID is 500 and therefore you can't modify the password of UID of 600. (This of course is always bypassed if you are a superuser on a machine and can control and change everything).

Since you ran passwd, it will start the process off using your real UID, and it will save the UID of the owner of the file (effective UID), so you can switch between the two. No need to modify all files with root access if it's not required.

Most of the time the real UID and the effective UID are the same, but in such cases as the passwd command they will change.

 

8. The Sticky Bit

One last special permission bit I want to talk about is the sticky bit.

This permission bit, "sticks a file/directory" this means that only the owner or the root user can delete or modify the file. This is very useful for shared directories. Take a look at the example below:

$ ls -ld /tmp

drwxrwxrwxt 6 root root 4096 Dec 15 11:45 /tmp
 

You'll see a special permission bit at the end here t, this means everyone can add files, write files, modify files in the /tmp directory, but only root can delete the /tmp directory.

Modify sticky bit

$ sudo chmod +t mydir
 
 

$ sudo chmod 1755 mydir

The numerical representation for the sticky bit is 1

 

Theory -01 :- Basic Linux Commands

 # 1: cd

 The "Change Directory" command enables you to navigate to another directory.

The cd command is THE most important command there is in Linux i think. As the command suggests, it enables

The user to change / jump to a directory.

Example: cd Downloads

Example: cd /etc/

Example: cd .. (Directory up!)

Note: After you have typed cd and entering the first or two letters of the directory you can press the TAB key to auto complete the directory! so... cd Do (press tab key) will auto complete it to Downloads. i use this a lot <‐‐

 

#2: man

The man command shows the users the "manual" of the command. In some situation you might need to get more information about the command you are using. The man command shows you this information about the command.

Example: man cp

This will open up the "cp" manual document for us in the shell. The manual shows us the parameters available for the commands.

Note: To close the manual simply press "Q"

 

#3: ls

In the absolute top 15 there's no way the ls command is missing. On the third place, the ls command. The ls command is used to list the files/directories within a directory.

Example: ls

It shows us the directories available.

 

#4: cp

The cp command is available for us to "Copy" things. This might be useful for duplicating files f.e. Example: cp file file2

Note: file is on this case the file the user wants to be copied... file2 is the name of the copied file. It's that simple.

 

#5 mv

The mv command is used for "Move" operations. The mv commands enable the users to move a file/directory to a specified location.

Example: mv /home/bas/Desktop/bla /home/bas/Desktop/fiets

Note: the first part of the command is the file that has to be moved. The second part (after the whitespace) is the target directory. Make sure you type in the full path using this command!

 

#6 mkdir

This command is used to "make" directories, NOT Files.. (that is possible with another command which i will bring up later in this tutorial)

Example: mkdir testdirectory

Note: The name of the directory is case sensitive which means that Test directory is a complete different directory as testdirectory.

 

#7 rmdir

 When you are able to make directories, you also want to know how to remove them. Removing directories is done by the rmdir command and belongs to the absolute basic commands in shell bashing. Example: rmdir fiets

Note: When the directory is not empty the command will prompt an error message: rmdir: failed to remove `fiets': Directory not empty So make sure it's completely empty before removing it.

 

#8 touch

Now we know how to make directories and deleting them, i now want to use the touch command. The touch command is used to make files.

 Example: touch vogel

This will create the file vogel for us in the directory.

 

#9 rm

The rm command stand for remove. The rm command is used in order the delete files instead of directories.

Example: rm vogel

Note: To remove files you must have the right permission bits set on the specific file.

 

#10 tar

Sometimes you have to archive files. Archiving files is a way to pack a set of files to one single file. The operation is done by the tar command.

Example: tar ‐cvf test.tar test (Creating a tar file from directory or file test)

Example: tar ‐xvf test.tar myexctractfolder (Extracts the particular tar file in the current working directory) In the example i used parameters. These parameters are telling the tar command how to behave and how to execute. After the parameters i entered the name of the file which is test.tar. The second part is the source directory/file of the tar file. In this situation a directory called test.

 

#11 pwd

Sometimes you really wonder where you are in the system. PWD is the solution for that problem. PWD stands for Path Working Directory.

Example: pwd

 

#12 ifconfig

Ifconfig is a command showing you information about the Ethernet adapters on your system. It contains very useful information like gateway, ip, and packet statistics. For the average user this command is rarely used, but i think it's worth knowing it.

Example: ifconfig note: To gain information about the wireless adapters on your system type ifconfig.

 

#13 locate

Locate is an extremely fast searching command. It shows the directories or files each on a new line. Example: locate syslog

Example: locate syslog | more (Piping structure used to invert the data from locates to the more command) note: Some keywords returns enormous amounts of hits. Use MORE to (see example) clear things up a bit.

 

#14 ping

Ping is used as a network diagnostic command by professionals. Ping offers information about the network we are on and if the other system responds to us. In cases of troubleshooting network related problems, ping can do a great job to determine the domain of the problem.

Example: ping www.google.com

The command returns the interval and % of loss during the test.

Note: You can stop ping bij pressing crtl‐c at the same time.

 

#15 chmod

The chmod command. The chmod command comes from "Change Mode" back to the unix times. It's a great command to restrict access to directories or files. But before i show you an example on how to use it, some theory. Chmod is qiet an advanced command to use. So therefore you really need to understand how it works. chmod works with so called permission bits. These bits can be set to a certain level of restrictions.

We have the following bits available:

 7 full

6 read and write

5 read and execute

4 read only

3 write and execute

 2 write only

1 execute only

 0 none

source: http://en.wikipedia.org/wiki/Chmod The bits shown above are the permissions for a particular group or class.

Files or directories contain four classes:

1st: The owner itself

2nd: Member of the file group

3rd: Others

4th: All of the above

To set the right permission bits the a particular group or class it is very important to select to right amount of permission bits.

for example, i will create a file and protect this file for being modified by anyone else besides me. Also

will i protect the file for being deleted

This is how i do it: chmod 400 mijndagboek

In this command i gave up the 4 bit in the "members of the group" 0 to others and 0 to all.

Now not even me is able to delete the file anymore without using the su do command.

But.. there is more. The classes i talked about earlier are divided into three separate like actions.. those are:

• Read

 • Write

• Execute

In order to add very specific restrictions to a file or folder you can use a trick to do that. I will show you how

If we want to restrict access to a file without knowing the exact bit number we can do the following. RWX = 7 which is the permission bit of Read, Write, and Execute together.

Separating these bits gives us the following values individually:

 Read = 4 bits.

Write = 2 bits.

Exec = 1 bit.

So we have 3 groups to take care of (the first group which is the owner is optional in chmod) 6 [membersgroupbit],[others],[alloftheabove]

 if we want to give everyone, and i mean everyone access to the directory i can do:

Chmod 777 mijndagboek

[read=4+Write=2+Execute=1=7],[read=4+Write=2+Execute=1=7],[read=4+Write=2+Execute=1=7]

This is not good!

We want to restrict the access for the file off course so a better chmod would be:

 Chmod 700

 [read=4+Write=2+Execute=1],[0][0]

What is ICTSM Trade? Complete information of ICTSM

ICTSM is a trade of ITI. It means Information Communication Technology System Maintenance. In this, a student is given information about the hardware and software related to the computer.


Full form of ICTSM

ICTSM is a course of information communication technology system maintenance; any student can do this course and with the help of it can work in information technology line.


What do you mean by ICTSM Trade?


ICTSM is a trade of ITI. It means Information Communication Technology System Maintenance. In this, a student is given information about the hardware and software related to the computer.

In this, it is taught that the problems occurring in the hardware and software of a computer can be removed. Along with this, the student is also taught about repairing computers and trouble shooting of internet and software.

In ICTSM, a student is taught all the work related to computer so that he can fix a computer. Whether it is a hardware problem or a software problem.

For this reason ICTSM is a very popular course. In which students can make their career. Now we know ICTSM ITI Trade Information.

 



ICTSM ITI Trade Information


In ICTSM a student has to study for 2 years. The course of ICTSM is also of 2 years. In this, the student is taught about the parts used in the computer in the first year. After this, the information about the software is also given to the student in the first year itself.

In the second year, the student is taught about computer repairing and trouble shooting of the Internet. This year they also have practical's so that they can learn to fix the computer with practical knowledge.
There are also some risks in doing this work. For this reason the student is also told about the risk. Some risk

  • If you have wet hands and feet, you do not have to touch the computer.
  • The power has to be turned off before opening any part.
  • All parts must be ground tested.
  • I have to turn off the switch before replacing the fuse wire.
  • To do every work, his related weapon has to be used.
This is some risk. Which you have to avoid. Many more such which are told to you while studying it.

Now we know what kind of syllabus you need to do this course.

So let's know ICTSM Syllabus.

 
ICTSM Syllabus And Books


The syllabus of ICTSM is told in 4 blocks. In which you have to study 2 blocks in the first year. In the next year, you have to study the subsequent 2 blocks.
In this, you have to read the book of Information Communication Technology System Theory. You can also order these books online. If you want complete PDF of ICTSM then you can download it from here.
 Now we know what kind of job you get in ICTSM, and how you can do job in it. So let's know ICTSM Job.
 
ICTSM Jobs


You can get a job in ICTSM in 4 ways

  1. As Office Assistant.
  2. As a Computer Operator.
  3. as a maintainer.
  4. Computer Hardware and Software and as Internet Networking Assistance.

In these 5 ways, you can get a job in this field. You can do any of these jobs. Now let's talk about how much celery you can get in this field. So let's know ICTSM job salary.
 
ICTSM job salary

If you start your career in this then you can get at least 15,000 initially. If you get experience of at least 1 year in this field, then your same salary increases to at least 45,000 per month. After this your celery keeps on increasing.


Theory -121 :- Root Cause Analysis

 

INTRODUCTION                            

           Root cause analysis (RCA) is a method of problem solving used for identifying the root causes of faults or problems.[1] A factor is considered a root cause if removal thereof from the problem‐fault‐sequence prevents the final undesirable event from recurring; whereas a causal factor is one that affects an event's outcome, but is not a root cause. Though removing a causal factor can benefit an outcome, it does not prevent its recurrence within certainty.

For example,

imagine an investigation into a machine that stopped because it overloaded and the fuse blew.[2] Investigation shows that the machine overloaded because it had a bearing that wasn't being sufficiently lubricated. The investigation proceeds further and finds that the automatic lubrication mechanism had a pump which was not pumping sufficiently, hence the lack of lubrication. Investigation of the pump shows that it has a worn shaft. Investigation of why the shaft was worn discovers that there isn't an adequate mechanism to prevent metal scrap getting into the pump. This enabled scrap to get into the pump, and damage it. The root cause of the problem is therefore that metal scrap can contaminate the lubrication system. Fixing this problem ought to prevent the whole sequence of events recurring. Compare this with an investigation that does not find the root cause: replacing the fuse, the bearing, or the lubrication pump will probably allow the machine to go back into operation for a while. But there is a risk that the problem will simply recur, until the root cause is dealt with.

General principles of root cause analysis

  1. The primary aim of root cause analysis is: to identify the factors that resulted in the nature, the magnitude, the location, and the timing of the harmful outcomes (consequences) of one or more past events; to determine what behaviors, actions, inactions, or conditions need to be changed; to prevent recurrence of similar harmful outcomes; and to identify lessons that may promote the achievement of better consequences. ("Success" is defined as the near‐certain prevention of recurrence.)
  2. To be effective, root cause analysis must be performed systematically, usually as part of an investigation, with conclusions and root causes that are identified backed up by documented evidence. A team effort is typically required.
  3. There may be more than one root cause for an event or a problem, wherefore the difficult part is demonstrating the persistence and sustaining the effort required to determine them.
  4.  The purpose of identifying all solutions to a problem is to prevent recurrence at lowest cost in the simplest way. If there are alternatives that are equally effective, then the simplest or lowest cost approach is preferred.
  5. The root causes identified will depend on the way in which the problem or event is defined. Effective problem statements and event descriptions (as failures, for example) are helpful and usually required to ensure the execution of appropriate analyses.
  6. One logical way to trace down root causes is by utilizing hierarchical clustering data‐mining solutions (such as GT data mining). A root cause is defined in that context as "the conditions that enable one or more causes". Root causes can be deductively sorted out from upper groups of which the groups include a specific cause. 154
  7. To be effective, the analysis should establish a sequence of events or timeline for understanding the relationships between contributory (causal) factors, root cause(s) and the defined problem or event to be prevented.

Limitations of Root Cause Analysis

RCA is one of the most widely used methods to improving patient safety, but few data exist that uphold its effectiveness. The quality of RCA varies across facilities, and its effectiveness in lowering risk or improving medical safety has not been systematically established. The quality of RCA is dependent on the accuracy of the input data as well as the capability of the RCA team to appropriately use these data to create an action plan. In some cases, only one source of error or a few sources of error are emphasized, when in reality the situation might be more complex. The thoughts, conversations, and relationships of members play an important role in determining the effectiveness of an RCA team People tend to select and interpret data to support their prior opinions. An atmosphere of trust, openness, and honesty is critical to encourage members to share what they know without fear of being criticized or unacknowledged.

General process for performing and documenting an RCA‐based Corrective Action

  1. Define the problem or describe the event to prevent in the future. Include the qualitative and quantitative attributes (properties) of the undesirable outcomes. Usually this includes specifying the natures, the magnitudes, the locations, and the timing of events. In some cases, "lowering the risks of reoccurrences" may be a reasonable target. For example, "lowering the risks" of future automobile accidents is certainly a more economically attainable goal than "preventing all" future automobile accidents.
  2. Gather data and evidence, classifying it along a timeline of events to the final failure or crisis. For every behavior, condition, action and inaction, specify in the "timeline" what should have been done when it differs from what was done.
  3.  In data mining Hierarchical Clustering models, use the clustering groups instead of classifying: (a) peak the groups that exhibit the specific cause; (b) find their upper‐groups; (c) find group characteristics that are consistent; (d) check with experts and validate.
  4.  Ask "why" and identify the causes associated with each sequential step towards the defined problem or event. "Why" is taken to mean "What were the factors that directly resulted in the effect?"
  5. Classify causes into two categories: causal factors that relate to an event in the sequence; and root causes that interrupted that step of the sequence chain when eliminated.
  6. Identify all other harmful factors that have equal or better claim to be called "root causes." If there are multiple root causes, which is often the case, reveal those clearly for later optimum selection.
  7.  Identify corrective action(s) that will, with certainty, prevent recurrence of each harmful effect and related outcomes or factors. Check that each corrective action would, if pre‐implemented before the event, have reduced or prevented specific harmful effects.
  8.  Identify solutions that, when effective and with consensus agreement of the group: prevent recurrence with reasonable certainty; are within the institution's control; meet its goals and objectives; and do not cause or introduce other new, unforeseen problems

Theory - 120 :- Service Management Concept

Service Management Concept

INTRODUCTION                

Service management in the manufacturing context, is integrated into supply chain management as the intersection between the actual sales and the customer. The aim of high performance service management is to optimize the service‐intensive supply chains, which are usually more complex than the typical finished‐goods supply chain. Most service‐intensive supply chains require larger inventories and tighter integration with field service and third parties. They also must accommodate inconsistent and uncertain demand by establishing more advanced information and product flows. Moreover, all processes must be coordinated across numerous service locations with large numbers of parts and multiple levels in the supply chain.

Among typical manufacturers, post‐sale services (maintenance, repair and parts) account for less than 20 percent of revenue. But among the most innovative companies in service, those same activities often generate more than 50 percent of the profits.

Benefits

  • The main drivers for a company to establish or optimize its service management practices are varied:
  • High service costs can be reduced, i.e. by integrating the service and products supply chain.
  • Inventory levels of service parts can be reduced and therefore reduce total inventory costs.
  • Customer service or parts/service quality can be optimized.
  • Increasing service revenue
  • Reduce obsolescence costs of service parts through improved forecasting.
  • Improve customer satisfaction levels.
  • Reduce expediting costs ‐ with optimized service parts inventory, there is no need to rush orders to customers.
  • Minimize technician visits ‐ if they have the right part in hand, they can fix the problem on the first visit.
  • Service strategy and service offerings
    •  Service strategy definition

    •  Service offerings definition & positioning 
    • Go‐to‐market strategy
    •  Service portfolio management
  • Spare parts management
    • Parts supply management
    • Inventory management
    • Parts demand management
    • Fulfillment operations & logistics
    • Service parts management
  • Returns, repairs, and warranties
    • Warranty & claims management  
    • Reverse logistics
    • Returns processing
    • Remanufacturing
  • Field service management or field force effectiveness
    • Technician enablement
    • Mobility
    • E‐learning
    • Activity scheduling
    • Service billing
  • Customer management
    • Order management & availability  
    • Channel & partner management
    • Customer insight
    • Technical documentation

  • Assets, maintenance, task scheduling, event management
    • Remote monitoring
    • Diagnostics & testing
    • Asset management/optimization
    • Configuration management