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.

learn more… | top users | synonyms (1)

44
votes
5answers
4k views

Redirecting stdout to a file you don't have write permission on

When you attempt to modify a file without having write permissions on it, you get an error: > touch /tmp/foo && sudo chown root /tmp/foo > echo test > /tmp/foo zsh: permission ...
108
votes
3answers
41k views

Why do directories need the executable (X) permission to be opened?

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?
6
votes
2answers
6k views

I added a user to a group, but group permissions on files still have no effect

I changed permissions of a file (chmod g+w testfile) and running ls -l testfile gives: -rwxrwxr-x 1 user1 user1 0 2011-01-24 20:36 testfile I then added a user to that group ("/etc/group" has ...
37
votes
3answers
44k views

Make all new files in a directory accessible to a group

Suppose I have two users A and B and a group G and a folder foo, both users are members of G (using linux and ext3). If I save as user A a file under foo, the permissions are: -rw-r--r-- A A. ...
22
votes
3answers
15k views

Why can't a normal user `chown` a file?

Why is the chown command root-only? Why can't non-root users use chown to give away files they own?
15
votes
4answers
5k views

Wrongly set chmod / 777. Problems?

I was trying to run chmod -R 777 ./ but ended up typing chmod -R 777 / and set 777 on my entire machine. What can go wrong? How can I fix it?
38
votes
2answers
17k views

Why can rm remove read-only files?

If I create a file and then change its permissions to 444 (read-only), how come rm can remove it? If I do this: echo test > test.txt chmod 444 test.txt rm test.txt ...rm will ask if I want to ...
75
votes
2answers
11k views

Why do we use su - and not just su?

I don't understand why su - is preferred over su to login as root.
27
votes
2answers
16k views

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 ...
73
votes
1answer
87k views

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 ...
5
votes
1answer
166 views

How to allow to run su instantly after I added the user to the appropriate group

I have the su executable with the following permissions: bash-4.2# ls -la /bin/su -rws--s--- 1 root wheel 59930 Sep 14 2012 ./su When I am logged in as a user, not in the wheel group and try to ...
14
votes
3answers
2k views

I accidentally chmod -R +x on a directory. How do I restore the correct permissions?

Well, to be specific, it was chmod -R 755. Now every file is executable, which I don't want. I am thinking that I should look at the first two bytes of each file for the #!, but will this cover ...
17
votes
2answers
7k views

How to apply changes of newly added user groups without needing to reboot?

Assume I'm logged in with user takpar: takpar@skyspace:/$ As root, I've added takpar as a member of group webdev using: # usermod -a -G webdev takpar But it seems it has not been applied. because ...
3
votes
7answers
5k views

Convert ls -l output format to chmod format

Say I have the following output from ls -l: drwxr-xr-x 2 root root 4096 Apr 7 17:21 foo How can I automatically convert this to the format used by chmod? For example: $ echo drwxr-xr-x | ...
6
votes
2answers
6k views

Getting new files to inherit group permissions on Linux

I am having a problem with permissions on a Linux server. I am used to BSD. When a directory is owned by a group the user who owns it isn't in such as www-data, files created in it will be owned by ...
9
votes
2answers
13k views

“rsync: failed to set permissions on …” error with rsync -a or -p option

When I use the -a option as is asked and answered in Preserve the permissions with rsync, I got a lot of "rsync: failed to set permissions on" errors. rsync: failed to set permissions on ...
28
votes
4answers
5k views

How to recover from a chmod -R 000 /bin?

And now I am unable to chmod it back.. or use any of my other system programs. Luckily this is on a VM I've been toying with, but is there any way to resolve this? The system is Ubuntu Server 12.10. ...
4
votes
1answer
4k views

In Linux, “Write” Permission Is Equivalent To “Execute” For Directories?

The Execute permission makes sense for files (which include scripts etc), but when it comes to directories, write (w) permission works the same way as execute (x), right? Which means, if we are giving ...
14
votes
6answers
5k views

Can root/superuser read my read-protected files?

On shared unix hosting, if I have a file sensitive-data.txt and I issue: chmod 600 sensitive-data.txt Can root user still read my file? Specifically I'm wondering if it's safe to store my password ...
11
votes
2answers
20k views

SSH and home directory permissions

It took me hours to solve this SSH problem with one of my class accounts on my school's servers. I couldn't ssh into one particular class account without entering my password, while passwordless ...
4
votes
2answers
167 views

Precedence of user and group owner in file permissions

I just ran into something unexpected (for me) regarding file permissions on Linux (Arch Linux). Basically I have: userX in groupX fileX userX:groupX ---rwx---- What puzzles me: I cannot perform ...
2
votes
3answers
3k views

read only access to all files in a specific sub-folder

I have got a specific folder located in "/home/.../reboot/". I have a series of users that require read-only access to the ever changing files within. My problem is that the same users are not ...
4
votes
3answers
1k views

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 ...
14
votes
3answers
6k views

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 ...
7
votes
2answers
21k views

How to add a ssh user who only has permissions to access specific folder?

How to add an ssh user who only has permissions to access specific folder? useradd -d /var/www/xyz.com.tr/musteri -s /bin/bash -g sshd musteri I created a user called musteri. I set its home ...
3
votes
2answers
2k views

Can't get Wireshark to run as user on CentOS

It's the first time I'm installing and configuring Wireshark in a rpm-based distro. In the past I've installed it properly on Ubuntu, Mint or Debian. Don't know why, but it seems I cannot run it as ...
9
votes
1answer
2k views

What does a dot after the file permission bits mean?

I performed an ls -la on directory on my CentOS 6.4 server here and the permissions for a given file came out as: -rwxr-xr-x. I understand what -rwxr-xr-x means, what I don't understand is the . ...
7
votes
1answer
6k views

Cannot delete a file - permission denied - why?

[db2inst1][testing ~/sqllib/db2dump] rm db2diag.log rm: cannot remove `db2diag.log': Permission denied [db2inst1][testing ~/sqllib/db2dump] id uid=1002(db2inst1) gid=107(db2iadm1) ...
7
votes
4answers
2k views

sudo permission denied but su grants permission

this is the first occurrence where su was required for me. I read an article about changing the value in /sys/devices/virtual/backlight/acpi_video0/brightness to alter my laptop's screen brightness. ...
5
votes
2answers
1k views

Permissions: What's the right way to give Apache more user permissions?

Context: I am making an in-browser control panel that gives me one button access to a library of scripts (.sh and .php) that I've written to process various kinds of data for a project. It's a "one ...
2
votes
3answers
640 views

What mechanism prevents any user from accessing any other user's files via root?

On a multi-user system, what protects against any user accessing any other users files via root? As context, the question is based on my understanding as follows: There are two commands related to ...
107
votes
7answers
8k views

How to chmod without /usr/bin/chmod?

Today I was told a tale by a Unix trainer, a tale 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 ...
33
votes
3answers
2k views

How does vim steal root owned files?

Witness the following: sh-3.2$ mkdir testcase sh-3.2$ cd testcase sh-3.2$ sudo touch temp sh-3.2$ ls -al total 0 drwxr-xr-x 3 glen staff 102 19 Dec 12:38 . drwxr-xr-x 12 glen staff 408 19 Dec ...
17
votes
3answers
8k views

Is there any way to prevent deletion of certain files from user owned directory?

Let's say user has Directory1 and it contains File1 File2 CantBeDeletedFile How to make so the user would never be allowed to delete the CantBeDeletedFile? If I change the ownership of Directory1 and ...
9
votes
1answer
12k views

How to (safely) move /tmp to a different volume?

Today the /tmp directory filled up on a machine at work. The problem was, it was on the root partition which wasn't very big. In order to fix this, a co-worker created a /new/tmp directory elsewhere, ...
4
votes
1answer
264 views

Give a specific user permissions to a device without giving access to other users

I have a card reader attached on /dev/sdb. What I do is giving all permissions to owner, group and the rest of the world, using: sudo chmod 777 /dev/sdb Can I just use another combination, ...
5
votes
3answers
8k views

Allow a user to read some other users' home directories

I am new to system administration and I have a permission related query. I have a group called administration. Inside the administration group, I have the users user1, user2, user3, superuser. All the ...
2
votes
1answer
255 views

what are the different ways to set file permissions etc on gnu/linux

On Unix a long time back I learned about chmod to set permissions and to allow programs to gain privileges. I have recently discovered extra commands on GNU/Linux: chattr, setfacl, setcap. Are there ...
12
votes
1answer
786 views

Can I restrict a user to use special programs?

Is it possible to add a user and restrict him to run special programs? For example after this user logs in, he can only open Firefox to use Internet and no other programs can be run by this user. For ...
9
votes
5answers
3k views

How to create a file even root user can't delete it

How to create a file even root user can't delete it ?
7
votes
3answers
12k views

How to get back sudo on Ubuntu?

I have done this: sudo chown -R myname /usr/ and now I can't use the sudo command because of this error: sudo: must be setuid root And as I read this means that the owner of this file ...
7
votes
3answers
3k views

External hard drive permissions - ext4

I have an external USB 3 disk drive (2TB capacity) that is most likely going to be moved from machine to machine. The disk has a GUID partition table and an ext4 partition. I am unable to write to the ...
7
votes
2answers
4k views

Why cannot find read /run/user/1000/gvfs even though it is running as root?

Can someone tell me what I'm doing wrong, what this is, or how to fix it? I'm running Fedora 18 and getting the error shown [root@servername /]# find . -name ngirc find: `./run/user/1000/gvfs': ...
7
votes
2answers
4k views

Group member cannot write even with write permission

The logged in user is a member of a group that has a write permission on a folder. But when this user is trying to write something, "permission is denied". The log below summarizes the question: ...
8
votes
1answer
6k views

Group within group file permissions

I tried finding this on here, but couldn't so sorry if it's a duplicate. Say I have 2 groups and a user: group1, group2, user1 with the following structure: group1 is a member of group 2, user1 is a ...
7
votes
1answer
3k views

Symbolic link permissions

I have access to a remote Linux machine where everytime I create a symbolic link, it is created by default with the following permissions: lrwxrwxrwx If I try to change the permissions of the ...
6
votes
1answer
2k views

Evince fails to start because it cannot read .Xauthority

I'm logged in remotely over SSH with X forwarding to a machine running Ubuntu 10.04 (lucid). Most X11 applications (e.g. xterm, gnome-terminal) work fine. But Evince does not start. It seems unable to ...
5
votes
2answers
3k views

ISO file readonly?

I have an ISO file and I mount it under /mnt/isofile. Then I copied this file to another folder. But the contents are read-only and belonged to root. I tried to use chmod and chown. But it prompts ...
5
votes
3answers
482 views

Unix users, groups, and permissions

I don't understand unix users, groups, permissions, etc. For example, things managed by the chmod, chgrp, usermod, groupadd, etc. commands. How do all these things work?
4
votes
3answers
2k views

granting write permissions to a group to a folder

How can I grant write permission to 1 group ? I have 2 users (alex and ben). alex is member of group alex and of group consult. ben is member of group ben and of group consult. I want to grant read ...