Search: This Site | People | Departments | Penn State  
Penn State Home Page Population Research Institute Home Page
  contact PRI news directory sitemap home

SSRI Home Page PRI Home Page

How can I make one of my files or directories accessible to another user?


 A: You need to set the file permissions on the file and/or directory using "chmod", but exactly how you do that depends on who the person is and how much access they need. Files (and directories) have three different _types_ of permission you can set:

 --"read" permission (r) makes the file or directory readable (for directories, this means you can do "ls");

 --"write" permission (w) means that the file/directory can be modified, overwritten, or erased (for directories, this means copying new files to and erasing files from the directory);

 --and "execute" permisson (x), which allows the file to be executed if it's something like a program or a script. For directories, execute means that you can "cd" to the directory or pass through the directory to get to directories farther down.

 There are also three different sets of people to whom the above permissions can be granted:

 --"User" (u)--the owner of the file

 --"Group" (g)--everyone in the group to which the user belongs. Users usually belong to several different groups, and the file can be associated with any one of them, though it's assigned to the user's "main" group (like "faculty" or "student") by default. To see the group ownership of files in a directory, type "ls -lg" (the "g" is for group"). To find out which groups you or another person belong to, type "groups ". To change the group ownership of a file that you own from one group to another that you belong to, type "chgrp ".

 --"Others" (o), also known as "world"--anyone.

 For each file and directory, each of these sets of people (u,g,o) will have some, all, or none of the three types (r,w,x) of permissions.

 Generally, you should allow as low a level of permission as you can get away with--don't give people write permissions if they only need to be able to read the files, for instance. Don't give "others" permissions if the person you want to have access belongs to some group to which you also belong.

 So, if the person you want to give access to only needs to be able to read your directory, not write to it, and they belong to some group--say, faculty--that you do, you can make sure they can get to your directory by:

 --Making sure the directory belongs to the right group ("chgrp ")

 --Giving read access to the group ("chmod g+r "). The format is "chmod", then the people for whom you are changing the permissions (u,g,o), then "+" to add the permission or "-" to remove it, then the type(s) of permission you are changing (r,w,x), followed by the filename or directory.

 --Making sure the the permissions on the individual files in the directory are set correctly.

Q:

I need to use someone else's data files. He changed the permissions to read for group and others on both the directory and the files. But, the system gives me a 'permission denied' when I try to access them. Is there anything else that needs to be changed?

A:

The directory also needs search (x) permission. Make sure also any parent dirctories have r-x permissions. To get access to ~joe/one/two.dat, you need to have access to the directory ~joe and the directory

~joe/one, as well as the file ~joe/one/two.dat.


Click Here To Go Back To Main Unix Page

Last modified: 10/26/01 | Contact Webmaster
Privacy and Legal Statements | Copyright Information | ©Copyright 2006, The Pennsylvania State University |