[an error occurred while processing this directive] Basic AFS

AFS Basics

AFS Info | F.A.Q. | Basic AFS | Advanced AFS | Kerberos | Features | Other Info


Table of Contents

  1. AFS File Permissions
    1. The Access Control List (ACL)
    2. Examining and changing an ACL: fs listacl, fs setacl
    3. Determining your quota: fs listquota
    4. Abbreviations: fs and ACL permissions shortcuts
    5. Recovering Files - fs mkmount, fs rmmount
    6. Getting Help!
  2. Tokens
    1. A token: your ticket to AFS
    2. The tokens and klog commands
  3. Account Setup
    1. Setting Up A Public Subdirectory
    2. Creating Public, Project, and Friends Directories

1. Permissions

  1. The Access Control List (ACL)

    Under AFS, permissions are set by directory not by file. Every file in a directory has the same permission. New directories inherit the parent's permissions.A directory's permissions is contained in the Access Control List (ACL). An ACL may have up to twenty entries. There are seven permissions you can set:

    l -- Lookup
    Allows user to ls the directory and examine its ACL. A user needs Lookup privilege to a parent directory as well to access asubdirectory of or file in a directory.
    Allow user to ls the directory and examine its ACL. A user needs
    r -- Read
    Allows user to read or copy any file in the directory.
    w -- Write
    Allows user to modify any existing file in the directory. This includes chmod permissions.
    k -- Lock
    Allows user to flock a file, ensuring two processes do not write simultaneously to the file.
    i -- Insert
    Allows user to add new files and create new subdirectories.
    d -- Delete
    Allows user to remove files and empty subdirectories.
    a -- Administer
    Allows user to change the ACL for a directory. Users always have this right for their home directory and their subdirectories even if they remove themselves from the ACL.

    NOTE: read, write, lock, insert, delete, and administer permissions all require lookup permission. The filing system cannot tell what file permissions the user has without lookup privilege. Similarly, users cannot access a subdirectory unless they have lookup privileges for ALL its parent directories.

  2. Examining And Changing An ACL: fs listacl, fs setacl

    The command fs is used to examine and change the ACL. It has a whole suite of subcommands; the major ones are fs listacl, fs setacl, and fs listquota.

    Warning: becareful who you give write permissions to. AFS users have limited quotas of 6mb, if you give write permissions a lot of people, you may find yourself running out of disk space.

  3. Determining Your Quota: fs listquota

    To list your disk quota, type:
    fs listquota

    To list other user's quota, type
    fs listquota ~[username]

  4. Abbreviations -- fs And ACL Permissions Shortcuts

    Okay, now that you have the basics down, here are some abbreviations to make your life slightly easier:
    fs setacl is fs sa
    fs listacl is fs la
    fs listquota is fs lq

    There are shortcuts for the ACL permissions
    read rl
    write rlidwk
    all rlidwka
    none (none -- removes user from acl)

  5. Recovering Files - fs mkmount, fs rmmount

    Between midnight and 3 AM each night, a backup image of your account is made. If you delete or modify a file in an AFS volume, you may be able to retrieve the file if it existed when the backup image was made. NOTE: Under most circumstances, you should be able to just go into your .backup directory and copy what ever file from there directly with out going through the following steps. However, sometimes the volume containing the backup is not mounted, so you may have to employ the following steps. The command:
    fs mkmount ~/.backup user.$USER.backup
    will mount your backup volume in the directory named .backup in your home directory. You can use a name other ~/.backup if you want. To unmount the volume type:
    fs rmmount ~/.backup

    You don't need to unmount it: files in .backup do not count against your disk quota usage.

    The backup volume (user.$USER.backup) is a read-only copy of your account. You cannot remove or alter files in the backup volume, and file changes made after the last backup but before the next backup are not available. To restore a file, you must copy the file from the backup volume to your account.

    Suppose you delete the file ~/Mail/incoming. The following commands may recover it (assuming you have sufficient quota and you do it in time):
    cd
    fs mkmount ~/.backup user.$USER.backup
    cp ~/.backup/Mail/incoming ~/Mail/incoming.bak
    fs rmmount ~/.backup
    The recovered file would be named incoming.bak in the Mail directory.

  6. Getting Help!

    Many AFS commands can be executed with a help argument or flag.

    To get a list of the fs subcommands, type:
    fs help

    To get a somewhat cryptic syntax list for a subcommand, you can type:
    fs [subcommand] -help

    To get the rather worthless manual page, type:
    man fs

    If it doesn't mention AFS, then add the following line to your .login:
    setenv MANPATH '/usr/man:/usr/local/man:/usr/pubsw/man:/usr/pubsw/X/man'
    That should give you a reasonable man page path.


2. Tokens

  1. A Token: Your Ticket to AFS

    When you login to your account, you obtain a "token" that is your validation to the local computer that you are who you say you are. This token has a lifetime of 24 hours. If your token expires, you are considered to be system:anyuser and will lose access to your private directories.

  2. The tokens And klog Commands

    To check if you have a token, run the command tokens.

    To obtain a new token, run klog. This will prompt you for your password and obtain a new token for you. If your username and AFS username are different, then use klog -x [afsusername], where [afsusername] is your AFS username.

    If you have trouble finding these commands, they should be located in the directory /usr/pubsw/bin.

For more information about tokens, read the kerberos section.


3. Account Setup

The default account setup has list privileges for system:anyuser on all your directories except the private and Mail directories.

The rest of section 3 outlines how to setup your dotfiles (.rhosts, .plan, .project, .forward), create public directories, and increase both account security and openness. A more secure (but more complex) directory setup is outlined in the advanced section. It describes a setup that keeps all the files in your home directory private, but enables you to have public and project directories. The average user should find the information below sufficient, though.

  1. Creating A Public Directory for Config and Other Files

    A public directory is the most secure way to store your .plan, .project, .klogin, and other files that need to be --or you wish to be--world-readable:
    cd
    mkdir public
    This directory may already exist
    fs setacl public system:anyuser read

    The cd command takes you to your root directory. The mkdir creates a public subdirectory. The fs command gives read permission to the subdirectory.

    Now you can make files public. For example, to make your .plan file readable, you type:
    cd
    mv .plan public/
    ln -s public/.plan

    The mv moves your .plan file to the now world-readable subdirectory. The ln creates a "symbolic link" from the file public/.forward to your root directory.

    You can do the same for your .project, and .klogin files, if you have them. NOTE: the .forward and .rhosts files do not work on the leland system; you have to use lelandforward to forward mail, and a .klogin file to allow kerberized rlogin or rsh from one Leland host to another. For example,
    cd ~$USER/
    mv .plan .project .cshrc .login .rhosts .dotfiles/
    ln -s public/.plan
    ln -s public/.project
    ln -s public/.klogin

  2. Creating Public, Project, and Friends Directories
    1. Setting Up Your Directories

      One of the powers of AFS is its file permissions (see section 1.1 for an overview). You can grant permissions to individual users or groups. Since AFS permissions are by directory, you only need to setup the permissions on the directory and its existing subdirectories. Files inherit the permissions of their directory. New subdirectories inherit their parent directory permissions.

      In order for a user to access a subdirectory, at least list (l) permission MUST be given on every parent directory of the subdirectory.

      If you use the home directory setup described in advanced section, then these directories must be created in ~$USER, not your home directory. You can then make a symbolic link from your home directory to the new directory.

    2. Creating a Public and/or Web Subdirectory

      You may already have a public directory in your account. In case you don't here are some examples commands that will create one for you:
      cd
      mkdir public
      fs sa pub system:anyuser read

      The cd command moves you to your root directory. The mkdir command creates a directory named pub. The fs command makes the directory readable for any user.

      Any subdirectories that you create in pub will also be public (since newly-created subdirectories inherit the permission of their parent directory). If you move a directory into this directory or use a symbolic link, however, you may need to adjust the permissions.

    3. Public Insert Directories

      Directories which provide insert privileges for anyone are a security hole. Anything added to this directory applies to your quota, so you need to watch the directory.

      If you do setup such a directory, it needs a minimum of system:anyuser li. It should have at a maximum system:anyuser rliw.

      If you use a subdirectory that someone added to your insert directory, be sure to change the file permissions back to system:anyuser none and to what it should be (public directories should have system:anyuser read).

    4. Project or Friend Directories

      Suppose you are working a project with curley and moe. Here's some commands that will create a project directory:
      cd ~$USER
      mkdir stooge
      fs sa stooge curley write
      fs sa stooge moe write

      The cd command moves you to your root directory. The mkdir command creates a project directory named stooge. The fs commands give users curley and moe write to that directory. (Be sure that you do not go over quota!) If you want others to be able to read the files, you can use:
      fs sa stooge system:anyuser read

      If you do not want them to have any access, use
      fs sa stooge system:anyuser none

      For a final example, suppose you are going to be creating five subdirectories: public, private, moe, curley, and larry. Since the names should be obvious, here's how to set them up:

      1. Put list on the root project directory (stooge). This is required to allow users to get to stooge/public:
        fs sa stooge system:anyuser l
      2. Create the public directory and make it world-readable.
        cd stooge
        mkdir public
        fs sa public system:anyuser read
      3. Now create the private directory.
        mkdir private
        fs sa private system:anyuser none
      4. Now a directory to contain details of pranks to be pulled on curley:
        mkdir moe
        fs sa moe curley none
        fs sa moe system:anyuser none

        And on moe:
        mkdir curely
        fs sa curley moe none

        And on both of them:
        mkdir larry
        fs sa larry moe none curley none

        And finally, let us strip system:anyuser from these directories
        fs sa -dir larry curley moe -acl system:anyuser none


Back To AFS Main Page
DCC Home |  Customer
Assistance Home |  ITSS Home |  Stanford Home
Contact HelpSU.Stanford.EDU if you have questions about the Leland system.