Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access...
-
Upload
kerrie-short -
Category
Documents
-
view
224 -
download
2
Transcript of Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access...
![Page 1: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/1.jpg)
Chapter 11
File Sharing
![Page 2: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/2.jpg)
Sharing Techniques
• Duplicate files• Common login• Setting appropriate access permissions on
shared files• Common group for team members• Sharing via links
![Page 3: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/3.jpg)
Sharing via Links
• A link is a connection between the file to be shared and the directory entries of the users who want to have access to this file
• 2 types of links exist:– hard links– soft (symbolic) links
![Page 4: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/4.jpg)
Figure 11.1 (a) Logical structure of current directory;
(b) contents of current directory
![Page 5: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/5.jpg)
Figure 11.1 (c) relationship among a directory entry, inode, and file contents
![Page 6: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/6.jpg)
Hard Links
• A hard link is a pointer to the inode of a file• Established using the ln command• The link count of the file is incremented• Both the original file and the new entry point
to the same inode• When deleted, the link count is decremented,
and the file is only deleted if the resulting link count is zero
![Page 7: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/7.jpg)
Figure 11.2 Establishing a hard link
ln Chapter3 Chapter3.hard
![Page 8: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/8.jpg)
ln command
Syntaxln [options] oldfile newfileln [options] old-file-list directory
Options-f force creation (overwrite existing
file)-n don’t force-s create soft(symbolic) link
![Page 9: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/9.jpg)
Figure 11.2 (c) hard link implementation by establishing a pointer to inode of the file
![Page 10: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/10.jpg)
Hard Link across directoriesln memo6.hard memos/memo6
![Page 11: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/11.jpg)
Hard Link across accountsln linuxbook/examples/demo1 ../bob/dir1
sarwar must have x-permission for bob and wx-permission for dir1
![Page 12: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/12.jpg)
Limitations of Hard Links
• Links cannot be established across file systems• If one of the files is moved to a different file
system, it is copied instead, and the link counts of both files adjusted accordingly
• Only superusers can create hard links to directories
![Page 13: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/13.jpg)
Soft (Symbolic) Links
• Established using the ln -s command• The link count of the file is not incremented• The created file is of the special type “link”
denoted by “l” in directory listings• The linked file is an actual file that contains the
path to the original file• Symbolic links can be created across file systems• Symbolic links to directories can be created by
any user
![Page 14: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/14.jpg)
Figure 11.5 Establishing a soft link
ln -s Chapter3 Chapter3.soft
![Page 15: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/15.jpg)
Soft links in directory listing
ln -s Chapter3 Chapter3.softls – il52473 -rwxr--r-- 1 sarwar faculty 9352 May 28 23:09 Chapter352479 lrwxr--r-- 2 sarwar faculty 8 Oct 13 14:24 Chapter3.soft --> Chapter3
![Page 16: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/16.jpg)
Figure 11.5 (c) soft link implementation by establishing a “pointer” to (pathname of) the existing file in the link file
![Page 17: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/17.jpg)
Soft Link across accounts
![Page 18: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/18.jpg)
Types of Symbolic Links
• absolute• relative• other_fs• messy• lengthy• danglingsymlinks command used for examining and
repairing links
![Page 19: Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.](https://reader035.fdocuments.us/reader035/viewer/2022062314/56649ecb5503460f94bd95d6/html5/thumbnails/19.jpg)
Drawbacks of Soft Links
• If the original file is moved to a different location, it can no longer be accessed via the symbolic link (dangling link)
• Extra space on disk and extra inode to store the link file
• Extra time required for access to the original file: the link file has to be read first, then path followed to target file