home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 22.19 Shell Scripts Must be Readable and (Usually) Executable Chapter 22
File Security, Ownership, and Sharing
Next: 22.21 How to Change File Ownership Without chown
 

22.20 Why Can't You Change File Ownership Under BSD UNIX?

[Chris is explaining why Berkeley UNIX systems allow only root ( 1.24 ) to change a file's ownership. If you need to change ownership, there is a workaround ( 22.21 ) .  - JP]

This restriction is not bogus, because the system supports disk quotas ( 24.17 ) . If you could give away your own files, you could:

mkdir .hide; chmod 700 .hide
cd .hide
create_huge_file >foo
chown prof1 foo
create_huge_file >bar
chown prof2 bar
create_huge_file >baz
chown prof3 baz

All you would need do is find someone with a high quota or no quota (such as a professor) who does not often check his own usage (such as a professor) and probably does not care that the disk is 99 percent full (such as a, er, well, never mind), and then give away files as necessary to keep under your own quota. You could regain ownership of the file by copying it to another disk partition, removing the original, and copying it back.

- CT in comp.unix.questions on Usenet, 6 July 1989


Previous: 22.19 Shell Scripts Must be Readable and (Usually) Executable UNIX Power Tools Next: 22.21 How to Change File Ownership Without chown
22.19 Shell Scripts Must be Readable and (Usually) Executable Book Index 22.21 How to Change File Ownership Without chown

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System