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.

Filter by
Sorted by
Tagged with
13
votes
5answers
12k 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 ?
13
votes
3answers
3k views

Is there a file that always exists and a 'normal' user can't lstat it?

I need this for a unit test. There's a function that does lstat on the file path passed as its parameter. I have to trigger the code path where the lstat fails (because the code coverage has to reach ...
13
votes
2answers
4k views

Run a binary owned by root without sudo

I had a question on a job interview: How can you execute (run) the program with the user user1 without sudo privileges and without access to the root account: $ whoami user1 $ ls -l ~/...
13
votes
4answers
49k views

Setting default username and group for files in directory

Using this helpful post I am able to set a default group and file permissions in a folder. I'm having trouble setting a default owner (teamlead uid 1234). setfacl -d -m g::rwx /my/test/folder ...
13
votes
4answers
38k views

File permission execute only

How can I set file to be executable only to other users but not readable/writable, the reason for this I'm executing something with my username but I don't want to give out the password. I tried : ...
13
votes
3answers
3k views

Best practice for mounting a Windows partition

I am running a dual boot of Windows and Debian on my Laptop. I use Linux mostly but from time to time I need to access my files in my Windows partition. My Windows partition is mounted as follows at ...
13
votes
2answers
47k views

-bash: cd: .ssh/: Permission denied

When I type in cd .ssh in terminal, it returns with -bash: cd: .ssh/: Permission denied. Now I cannot add my ssh keys to ssh. When I type ssh-add ~/.ssh/idname it says /Users/Dan/.ssh/idname: ...
13
votes
3answers
6k views

Maintain (or restore) file permissions when replacing file

I have a command that accepts a file as an argument, modifies the file, then writes it to the file name specified in the second argument. I'll call that program modifyfile. I wanted it to work "in ...
13
votes
2answers
10k views

I can't delete a file that I have write permissions for as a group member

$ touch testfile $ chmod g+w testfile $ sudo adduser user2 user1 $ stat -c'%a %A' testfile 664 -rw-rw-r-- $ su user2 Password: $ groups user2 user1 $ rm testfile rm: cannot remove `testfile': ...
13
votes
1answer
22k views

List IP tables in Docker Container

I want to run the iptables command in a Ubuntu 16.04 Docker container. I have created a user, given that user root permissions, added them to the sudo group, but I am still being told that I am not ...
13
votes
4answers
25k views

How to restore default group/user ownership of all files under /var?

I accidentally changed /var owner/group to my username and then changed it back to root, but not all the /var folders' owners are root, so is there anyway to change back owner/group of files/folders ...
13
votes
3answers
9k views

Is there a typical way to pass a password to a Systemd Unit file?

I would like to start a service using a systemd unit file. This service requires a password to start. I don't want to store the password in plaintext in the systemd unit file, because it is world-...
13
votes
2answers
22k views

Why are 666 the default file creation permissions?

As I've found out, when using umask, the highest permissions you can give to files are 666. Which is done by umask 0000. That's because of the default file creation permissions, which appear to be 666 ...
13
votes
2answers
23k views

What's the idea behind rm not removing non-writable file by default?

What's the idea behind rm not removing non-writable file by default? Every time you want to remove a file that is non-writable file for current user but you have a write permission on directory get ...
13
votes
7answers
32k views

Device is Mounting as Read Only (Can Copy Files as Root)

I am attempting to mount my Amazon Kindle, 3rd Edition. It automounts correctly and when I run mount -l, I get the following output: /dev/sdg1 on /media/usb0 type vfat (rw,noexec,nodev,sync,noatime,...
13
votes
1answer
14k views

Find a user's writable files and directories [duplicate]

How can I determine all files and folders that given user can write to? The user is nobody. Some script in bash or python, perhaps? I'm using Ubuntu 11.04
13
votes
2answers
18k views

How does umask affect ACLs?

Can someone explain to me how umask affects the default mask of newly created files if ACLs are activated? Is there some documentation about this? Example: $ mkdir test_dir && cd test_dir $ ...
13
votes
2answers
17k 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: ...
13
votes
2answers
9k views

recursively change file permission but not directories?

I was doing a mass recursive change of permissions of some files that I had migrated to a unix system. I changed them to ug+rw, but then I found that I could not traverse subdirectories. I looked at ...
13
votes
4answers
13k views

How to inspect group permissions of a file

I would like to inspect group permissions of a file from a bash script. Specifically, I need to check whether a file has the group writeable bit on. That's it. Simple as that. However: I also need ...
13
votes
1answer
4k views

What does x (execute) permission do on unix sockets?

By my experience unprivileged user can not access unix socket he/she does not own without x bit set. What does this bit do exactly? Thanks
13
votes
3answers
10k views

Restrict file access to append only

I have a directory with log files and I'm putting logs from script launched by users into them. Logging with syslog doesn't seem possible in this case. (non-daemon rsync) I want the users to have ...
13
votes
2answers
4k views

How can I change the permissions in /sys to alter the state of a LED/light using `udev`?

I've got a Thinkpad and would like to use the ThinkLight (the white flash light above the screen designed to light up the keyboard) for notifications on incoming Jabber messages. It is easy to ...
12
votes
4answers
62k views

su: Permission denied despite correct password

In my new Gentoo installation, su doesn't work as my non-root user: After entering the correct password I get the message "su: Permission denied". What could be causing this? I have already tried ...
12
votes
3answers
6k views

Why is “rm -r” unable to delete this folder?

I have a folder with -wx permissions called folder1 and another folder inside it called folder2 with rwx permissions. I tried to delete folder1 using this command: rm -r folder1 But I got the ...
12
votes
3answers
74k views

How to give user root permissions?

I just installed Arch. Works great. I created a new user, logged in with it and now I'm trying to install several things with pacman. But I keep getting the error: error: you cannot perform this ...
12
votes
6answers
43k 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 /usr/bin/...
12
votes
2answers
2k views

How do I grant different permissions for each user?

So, I've been using Linux for a few years now, and I really should know this answer, but I'm having trouble finding it. Specifically I've been using Debian based distro's....mostly Ubuntu. If I have ...
12
votes
2answers
3k views

Can I make a file only accessible to a script, and not a user?

I have a user with limited access on the system (that is, he is not a sudoer); let's call him Bob. I have a script or a binary which I, the system administrator, trust, and would have no problems ...
12
votes
3answers
67k 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 ...
12
votes
2answers
27k views

Give user access to folder without changing ownership?

I have a script that works with /etc/NetworkManager: drwxr-xr-x 6 root root 4096 Apr 3 2017 NetworkManager/ I want to give the user programX write permission for this folder without changing ...
12
votes
2answers
12k views

rsync doesn't preserve directory ownership even with -a

I use this rsync invocation to backup my home directory: rsync -aARrx --info= --force --delete --info=progress2 -F "$USER_HOME" "$BACKUP_MNTPOINT" rsync man page says that -a implies -g and -o (...
12
votes
2answers
37k views

wireshark: Couldn't run /usr/sbin/dumpcap in child process [duplicate]

Possible Duplicate: How to add write permissions for a group? When I run Wireshark, It shows the following message: Couldn't run /usr/sbin/dumpcap in child process: Permission denied Are you a ...
12
votes
1answer
3k views

Group permissions for root not working in /tmp

I experience a strange behaviour in my /tmp directory. Although a user belong to a group has permissions to read/write a file, he cannot do so. In this example, I create a new file /tmp/test.txt as ...
12
votes
5answers
38k views

How to give permissions to read write but not delete the file

I want to give users the ability to create write and read files in other user directory, but not to have option to delete the file after created ( sticky bit not going to work here ... ) for example :...
12
votes
2answers
4k views

Can super user write into read-only files?

I've stumbled upon surprising (for me) permission behavior on FreeBSD. Let's say I'm operating as non-root user. I create a file, set its permission on read-only and then try to write into it: $ ...
12
votes
3answers
16k views

How do Linux permissions work when a process is running as a specific group?

This is something I haven't been able to find much info on so any help would be appreciated. My understanding is thus. Take the following file: -rw-r----- 1 root adm 69524 May 21 17:31 ...
12
votes
1answer
7k views

Symbolic link permissions don't change with chmod

I have access to a remote Linux machine where every time I create a symbolic link, it is created by default with the following permissions: lrwxrwxrwx If I try to change the permissions of the ...
12
votes
2answers
20k views

How does ACL calculate the effective permissions on a file?

I ran the following command to give the wheel group rwx permissions on new files and subdirectories created: [belmin@server1]$ ls -la total 24 drwxr-sr-x+ 2 guards guards 4096 Aug 27 15:30 . drwxr-...
12
votes
2answers
16k views

Using setfacl to allow group members to write to any file in a directory

I'd like to use setfacl so that anyone in group 'app' can edit any file contained within /usr/local/users/app regardless of what the traditional UNIX permissions say. I have two users john and ben. I ...
12
votes
1answer
2k views

Permission bits not being enforced on samba share

I have a problem where permission bits are not being enforced on a samba share using a Linux client. I have samba configured on the server to force a certain user, group and permission bits and this ...
11
votes
3answers
6k views

Why is a file with 400 permissions seen writable by root but read-only by user?

If I create a file as an unprivileged user, and change the permissions mode to 400, it's seen by that user as read-only, correctly: $ touch somefile $ chmod 400 somefile $ [ -w somefile ] && ...
11
votes
3answers
2k views

How are users able to execute a file without permission?

I created a Bash script which echoes "Hello World". I also created a test user, bob, using adduser. Nobody has permission to execute that file as denoted by ls: $ ls -l hello.sh -rw-r--r-- 1 ...
11
votes
3answers
2k views

How to copy a directory which root can't access to a directory that only root can access?

I have a directory on an nfs mount, which on the server is at /home/myname/.rubies Root cannot access this directory: [mitchell.usher@server ~]$ stat /home/mitchell.usher/.rubies File: `/home/...
11
votes
2answers
4k views

How to maintain the ownership of a file after editing?

My question is similar to this other one, excepted that one asks about newly created files. In my Unix box, users alice, bob and tomcat are in the group tomcat. The configuration files of the Tomcat ...
11
votes
4answers
3k 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. ...
11
votes
1answer
28k views

What does “execute” permission mean on a folder? [duplicate]

I have read this topic, which gave me some info but I feel I am not fully getting it. What does the execute permission actually mean on a folder? I fully understand what it means on a file, but on a ...
11
votes
1answer
11k views

Difference between systemd and terminal starting program

I am curious as to what this difference is between programs that are; started with systemd when enabled through systemctl, vs those started by means of /etc/rc.local or through the CLI. For example, ...
11
votes
1answer
21k views

What are the correct permissions for a systemd .service?

I need to create a service for a web server called daphne I would like to know what are the correct linux permissions for this. or if exists a general rule for whatever systemd service?
11
votes
1answer
4k views

What is the difference between 'ls' and 'ls -l' when I don't have execute permission on that directory?

I created a directory called folder and took away execute permission. $ mkdir folder $ touch folder/innerFile $ mkdir folder/innerFolder $ chmod -x folder Now if I do $ ls folder it outputs a list ...

1
3 4
5
6 7
76