Questions tagged [permissions]

Permissions are the Unix way of controlling access to resources such as files, directories and devices and may be specified for an owner, group, or all users.

Permissions on Unix-like systems are managed in three distinct classes. These classes are known as user, group, and others. In effect, Unix permissions are a simplified form of access control lists (ACLs).

There are three specific permissions on Unix-like systems that apply to each class:

  1. The read permission, which grants the ability to read a file. When set for a directory, this permission grants the ability to read the names of files in the directory (but not to find out any further information about them such as contents, file type, size, ownership, permissions, etc.).
  2. The write permission, which grants the ability to modify a file. When set for a directory, this permission grants the ability to modify entries in the directory. This includes creating files, deleting files, and renaming files.
  3. The execute permission, which grants the ability to execute a file. This permission must be set for executable binaries (for example, a compiled C++ program) or shell scripts (for example, a Perl program) in order to allow the operating system to run them directly. When set for a directory, this permission grants the ability to traverse its tree in order to access files, including file metadata, or subdirectories, but not list the files inside the directory (unless read is also set).

When a permission is not set, the rights it would grant are denied. Unlike ACL-based systems, permissions on a Unix-like system are not inherited. Files created within a directory will not necessarily have the same permissions as that directory.

Further reading

4379 questions
543
votes
12 answers

How do I copy a folder keeping owners and permissions intact?

So I was going to back up my home folder by copying it to an external drive as follows: sudo cp -r /home/my_home /media/backup/my_home With the result that all folders on the external drives are now owned by root:root. How can I have cp keep the…
Psachnodaimonia
  • 5,555
  • 3
  • 14
  • 8
513
votes
9 answers

Execute vs Read bit. How do directory permissions in Linux work?

In my CMS, I noticed that directories need the executable bit (+x) set for the user to open them. Why is the execute permission required to read a directory, and how do directory permissions in Linux work?
Nick.h
  • 6,193
  • 4
  • 20
  • 16
359
votes
5 answers

How to set default file permissions for all folders/files in a directory?

I want to set a folder such that anything created within it (directories, files) inherit default permissions and group. Lets call the group "media". And also, the folders/files created within the directory should have g+rw automatically.
Chris
  • 8,320
  • 5
  • 23
  • 18
230
votes
4 answers

Do the parent directory's permissions matter when accessing a subdirectory?

If I have a root folder with some restrictive permission, let's say 600, and if the child folders/files have 777 permission will everybody be able to read/write/execute the child file even though the root folder has 600?
Ken Li
  • 2,435
  • 3
  • 16
  • 8
222
votes
1 answer

How to skip "permission denied" errors when running find in Linux?

Possible Duplicate: How do I remove “permission denied” printout statements from the find program? When I run this command in Linux (SuSE): find / -name ant I get many error messages of the form: find: `/etc/cups/ssl': Permission denied Does…
user710818
  • 2,459
  • 3
  • 17
  • 12
212
votes
4 answers

Why do we use su - and not just su?

I don't understand why su - is preferred over su to login as root.
Dharmit
  • 4,220
  • 7
  • 28
  • 37
180
votes
7 answers

What does the @ mean in ls -l?

I am using Mac OSX. When I type ls -l I see something like drwxr-xr-x@ 12 xonic staff 408 22 Jun 19:00 . drwxr-xr-x 9 xonic staff 306 22 Jun 19:42 .. -rwxrwxrwx@ 1 xonic staff 6148 25 Mai 23:04 .DS_Store -rw-r--r--@ 1 xonic staff …
Larry Wang
  • 2,625
  • 4
  • 20
  • 11
172
votes
10 answers

How to chmod without /usr/bin/chmod?

Today I was told a tale by a Unix trainer where the root password got leaked to the students, and one of the fellas removed the execute permission from /usr/bin/chmod itself. How do you recover chmod in this case and make it executable again? Let's…
Sundar R
  • 1,578
  • 2
  • 10
  • 7
171
votes
3 answers

Make all new files in a directory accessible to a group

Suppose I have two users Alice and Bob and a group GROUPNAME and a folder foo, both users are members of GROUPNAME (using Linux and ext3). If I save as user Alice a file under foo, the permissions are: -rw-r--r-- Alice Alice. However, is it…
student
  • 17,875
  • 31
  • 103
  • 169
168
votes
1 answer

What does the "@" (at) symbol mean on OSX ls?

When I check permission of less files from the command line on my Snow Leopard OSX system using Bash I see -rw-r--r--@ for certain files and for others I just see -rw-r--r-- What does the @ mean here?
rhand
  • 1,845
  • 2
  • 12
  • 10
164
votes
4 answers

How does the sticky bit work?

SUID The sticky bit applied to executable programs flagging the system to keep an image of the program in memory after the program finished running. But I don't know that what it's stored in memory. And how I can see them, in this case.?
lotusirous
  • 3,609
  • 5
  • 17
  • 11
162
votes
3 answers

Mount cifs Network Drive: write permissions and chown

I have access to a cifs network drive. When I mount it under my OSX machine, I can read and write from and to it. When I mount the drive in ubuntu, using: sudo mount -t cifs -o username=${USER},password=${PASSWORD} //server-address/folder…
Vincent
  • 2,778
  • 6
  • 23
  • 28
157
votes
3 answers

How to change ownership of symbolic links?

I am facing some issue with creating soft links. Following is the original file. $ ls -l /etc/init.d/jboss -rwxr-xr-x 1 askar admin 4972 Mar 11 2014 /etc/init.d/jboss Link creation is failing with a permission issue for the owner of the file: ln…
Zama Ques
  • 3,186
  • 12
  • 39
  • 54
155
votes
8 answers

Clone ownership and permissions from another file?

Is there a command or flag to clone the user/group ownership and permissions on a file from another file? To make the perms and ownership exactly those of another file?
user394
  • 14,194
  • 21
  • 66
  • 93
153
votes
2 answers

SSH Key Permissions chmod settings?

I need to use SSH on my machine to access my website and its databases (setting up a symbolic link- but I digress). Following problem I enter the command: ssh-keygen -t dsa To generate public/private dsa key pair. I save it in the default…
crissixpaul
  • 1,631
  • 2
  • 10
  • 5
1
2 3
99 100