Miscellaneous
  Home arrow Miscellaneous arrow Page 3 - Rights Management in UNIX
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MISCELLANEOUS

Rights Management in UNIX
By: Gabor Bernat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2009-03-25

    Table of Contents:
  • Rights Management in UNIX
  • Groups and rights
  • Change the rights
  • Some extra rights

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Rights Management in UNIX - Change the rights


    (Page 3 of 4 )

    You can change rights with the chmod command. The syntax looks like this:

    chmod [3 digit octal number] [on what file]

    For example:

    chmod 775 alfa.txt

    This will set the right 775. Expand to 111 111 101. Now if we replace the 1 with a set of the right and a – for the unset (we got that from the ls), we will get back rwx rwx r-x. Everyone has all rights, but the final group cannot write to the file. The second option is to use the syntax:

    chmod [letter from who] [+ or – (set or unset right] [ what right] [on what file]

    For example:

    chmod u-x, o+w alfa.txt

    From the model, we can see that with the second syntax we can make multiple changes at once; we just need to separate the tasks with a comma. In this we unset the execute right from the user, and set the write right for the other group.

    The chmod command also has a couple of option flags we can turn on. However, we rarely use them. The first is the –f, which forces the command to execute. In addition, it will not echo back with an error message if one occurs. The second is the –R. This will make the changes recursively along the file system tree of a directory we give. This is a dangerous option, as it will change the rights for both the folders and the files.

    For a file, the rights are quite self-descriptive: to be able to write to a file means you can modify it, while the read right means you can see what is in the file, and the execute right is obvious. When we talk about directories, this changes a little.

    The read right means that we can read the directory file. This just means that we can list the files found inside it. However, we can only list what is inside the file; we can't also access it. As said, the directory is only a file with directory entries inside. This allows us to read the file, not what is in each folder. 

    The write right means that we can add new entries to the directory file and  create below it a new file/directory. The execute right means that we can pass through the directory. This is required to reach the files/directories below the directory.

    This last one is very valuable for web servers. You are not allowed to cause havoc on the server. You have a given amount of storage space inside a directory; however, you should not modify the rest of the files found in the server, otherwise you may abuse it and the server would crash. In these situations, you will have only execute rights to a specific folder, and the rwx rights below that. This assures that you can use your storage and still not modify important files on the server.

    More Miscellaneous Articles
    More By Gabor Bernat


     

    MISCELLANEOUS ARTICLES

    - Using PHP to Stream MP3 Files and Prevent Il...
    - 10 Must Have Firefox Improvements
    - All About OpenOffice 3.0
    - Shell Script Writing
    - Loops in the UNIX Shell
    - The Test in the UNIX Shell
    - Data Streams and the UNIX Shell
    - Control Mechanisms of the UNIX Shell
    - Variables Within the UNIX Shell
    - The Shell and UNIX
    - In Detail: UNIX File Systems
    - Rights Management in UNIX
    - UNIX File Systems
    - The Terminal in UNIX
    - Operating Systems and UNIX





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek