Unix chapter 11 file sharing
This presentation is the property of its rightful owner.
Sponsored Links
1 / 17

UNIX Chapter 11 File Sharing PowerPoint PPT Presentation


  • 34 Views
  • Uploaded on
  • Presentation posted in: General

UNIX Chapter 11 File Sharing. Mr. Mohammad Smirat. Introduction.

Download Presentation

UNIX Chapter 11 File Sharing

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Unix chapter 11 file sharing

UNIX Chapter 11 File Sharing

Mr. Mohammad Smirat


Introduction

Introduction

  • When group of people work together on project they need to share information, such as files and directories. There are several methods which can be used to allow a group of users share files and directories. Such methods are

  • Duplicate shared files. Make copies of the files and distribute them to all team members. This method works if the team members are to work on these files sequentially, not simultaneously because when working at the same time each one is working on his own copy and copies becomes inconsistent.


Introduction cont

Introduction (cont…)

  • Common login for members of a team, the system admin create a new group contains all members and give them a new account number to which all have access. This could be a headache for the system admin because it generate a lot of work for them, in the meantime each user will have more than account number one for each project.

  • Setting appropriate access permission on shared files, put all shared file under one member’s account, and the access permission on these files are set so that all team members can access them. This work if only these members form the user group, if the group have other users in it, they will have access to the files.


Introduction cont1

Introduction (cont…)

  • Common group for members of a team,the system admin will create a new user group consisting only the members of the working team only. This is an effective method and used often.

  • File sharing via links, the attributes of a UNIX file are stored in its inode on disk. When a file is opened, its inode copied into the main memory. A link is a way to establish a connection between the file to be shared and the directory entries of the users who want to have access to this file. So, when we say a file has N links, we means that file has N directory entries.

  • You have to have an access for the file, having the link with no access is not going to get you anywhere.


Hard links

Hard links

  • It is a pointer to the inode of a file, remember the directory entry comprises two thing the inode number and the file name.


Creating links

Creating Links

  • $ln[options] existing-file new-file$ln[options] existing-file-list directory

  • The ln command without an option creates a hard link to a file provided that the user has execute permission for all the directories in the path leading to the file.


Creating links cont

Creating Links (cont…)

$ls -il13245 -rwx------ 1 ymk ………………....chapter122103 -rwx-------1 ymk………………….chapter2$ln chpater2 chapter2.hard$ls -il13245 -rwx------ 1 ymk ………....chapter122103 -rwx-------2 ymk………….chapter222103 -rwx-------2 ymk ………....chapret2.hard

  • The system creates new directory entry (22103, chapter2.hard), thus you can point to can refer to chapter2 by accessing chapter2.hard as well because both names point to the same file on disk.


Creating links cont1

Creating Links (cont…)

$rm chapter2$ls -il13245 -rwx------ 1 ymk ………....chapter122103 -rwx------ 1 ymk ………....chapret2.hard

  • The directory entry is removed but the file still there and the link count has been decremented from 2 to 1.

  • $ln -f /users/bin/sample ~if sample file exists on your home directory the -f command will over write it, otherwise you’ll get a message telling you sample does not exists on your directory. Notice the name of the link in your home directory will be sample which it is the same as the original name of the file. If you do an ls command in both directories you will see the same name of the file with the link count incremented by one.


Drawbacks of hard links

Drawbacks of Hard Links

  • Can not be established between file are not on different file systems.

  • Only a super user can create a hard link to a directory.

  • Some editors remove the existing version of the file that you are editing and put the new version in new files, in this case any hard link to the removed file do not have access to the new file. (none of the commonly used editors do so- they are safe to use).


Soft symbolic links

Soft/Symbolic Links

  • When you create a soft link, a new file of type link is created.

  • This file contains the pathname of the existing file.

  • When we make a reference to the link file, the UNIX system sees the type of the file is link and reads the link file to find the pathname for the actual file to which we are referring.


Creating soft symbolic links

Creating Soft/Symbolic Links

  • You can use the soft link using the command ln with option -s .

    $ln -s chapter2 chapter2.soft

    $ls -il

    13245 -rwx------ 1 ymk..123..chapter122103 -rwx------1 ymk…543.chapter234251 1rwx------1 ymk …8 chapret2.soft -> chapter2

  • We notice the following

    • The inode number for both files are different.

    • The original file type is ordinary, the other is of type l.

    • The link count is one for both files.

    • The size of the files are different.

    • The name of the link file is followed by ->chapter2


Soft symbolic links cont

Soft/Symbolic Links (cont…)

  • The soft link can be created to all the files, including directory files, you can create a soft link across file systems. Also file of soft links can be edited by any kind of editors without ant bad effects on them.


Soft links file problems

Soft links file problems

  • If the file that the soft link points to is moved to another directory, it can no longer be accessed via the link.

  • UNIX has to support an additional file type, and new file has to be created for every link. (space overhead)

  • Slow file operation, open the first file read the contents in order to reach the actual file.


  • Login