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

4455 questions
76
votes
4 answers

Is there any difference between mode value 0777 and 777

I saw a code change at work, where the mode values were changed from 777 to 0777 to make nfs setattr work. What is the difference in the 2 values?
72
votes
3 answers

Uppercase S in permissions of a folder

What does the letter S mean below? The file in question is a folder.                                                                 I read here that an upper-case S can represent that the setgid bit is active for a binary executable. But this is a…
42
votes
6 answers

-bash: /dev/null: Permission denied

I'm trying to create a new user on a Centos 6 system. First, I do useradd kevin Then, I tried to run commands as that user su - kevin However, I get the following error messages -bash: /dev/null: Permission denied -bash: /dev/null: Permission…
Kevin Burke
  • 1,971
28
votes
4 answers

Test effective permissions of file for user

Is it possible to test effective permissions of a file for a specific user? I normally do this by su user and then accessing the file, but I now want to test this on an user with no shell (i.e. a System user)
dtech
  • 987
22
votes
2 answers

Can I allow users to chmod a file not owned by them?

I would like to allow users to chmod a file that is owned by root or some user that is not themselves. I have chmod'ed the file to 777 and I get "operation not permitted". I have added the user to the group of the file and get the same. Why can't a…
20
votes
4 answers

Permission denied to change gid(group) of a file I own

It appears I still miss some things about the way permissions work. I am on a debian 7 system btw. just now I have this file of which I downloaded and it belongs to myuser:myuser, that is both user and group are set to me. It also resides in my…
nass
  • 1,458
19
votes
4 answers

What is the reason for having or restricting file owner's permissions?

As discussed in Understanding UNIX permissions and file types, each file has permission settings ("file mode") for: the owner / user ("u"), the owner's group ("g"), and everyone else ("o"). As far as I understand, the owner of a file can always…
paperskilltrees
  • 325
  • 2
  • 8
18
votes
3 answers

How Do I check Permissions of Root Folder (/ Folder, not /root)?

Is there a way to check the permissions of the root folder, /? I mean the folder's permissions, not its content's (/var, /usr, etc.) permissions? Running ls /.. shows the content's permissions.
trysis
  • 333
15
votes
1 answer

How are file permissions applied to newly created files?

I have a directory that has the following permissions set: drwxr-s---. user group folder On the desktop, I access this folder and right click to create a new file call foo.txt. Then using the terminal, I created another file using the command $…
14
votes
2 answers

How to execute a file without execute permissions

Let's say user wants to execute a script test.sh but ls -l test.sh gives -rwxrwxr-- 1 root root 96 Feb 25 21:44 test.sh Now if user doesn't want to make a copy of test.sh (on which he does chmod +x), he can simply do sh test.sh to execute…
viuser
  • 2,614
13
votes
5 answers

Directory with +x permission, parents without it. When would this be useful?

Say I have a folder called folder in the following path: my_path = /a/b/c/d/e/folder and a file called file in that folder. Then, say I run this command to remove group permissions under /a/ > chmod g-rwx -R /a/ Now, say I give +rx permissions to…
11
votes
3 answers

How to allow folder permission for another user in Linux?

Consider two user accounts user1 and user2 on one Linux machine. I want user2 to be able to have read and write access to a folder in user1 home directory. So far created a group for both users and added both users groupadd twousers usermod -a -G…
A.Dumas
  • 435
11
votes
3 answers

How to investigate what is modifying a directories permission on Linux?

We have an Ubuntu 12.04/apache server and a directory in the "/var/www/foo" and root permission. Something is repeatedly changes the permission of this directory. Question: How can we investigate, what is changing the permission?
9
votes
3 answers

How to copy a file from my home folder to /usr

I'm trying to copy a file from my homedir to /usr. How do I setup the permissions to allow this? $ chmod 777 KeePass-2.14.zip $ cp KeePass-2.14.zip /usr/keepass/ cp: cannot create regular file `/usr/keepass/KeePass-2.14.zip': Permission denied $…
ripper234
  • 31,763
7
votes
2 answers

chattr: Inappropriate ioctl for device while reading flags

I want to move a file from my Raspberry Pi (Openhabian OS) to a USB stick, however the cp command returns cp dir1/Controller.py /media/usb/ cp: cannot create regular file '/media/usb/Controller.py': Permission denied. I tried to get permission via…
cheesus
  • 185
1
2 3
11 12