Questions tagged [chmod]
chmod is used to change the commonly used read, write, and execute permissions on files. It can change these permission bits for the file owner, the file's group owner, and everyone else. It can also change the more esoteric ‘permissions’ (attributes, reall) like set-user-ID, set-group-ID, and sticky bits.
619 questions
0
votes
0
answers
39
views
Why does `chmod 640` prevent group read access on macos?
I'm a student learning UNIX permissions and scripting on macOS. I created a short script that makes a file and applies chmod 640. However, a user in the same group cannot read the file.
Here is the ...
0
votes
2
answers
117
views
Restrict a users access to all directories but one
So there is a user that was created by root, and it pretty much has access to most/all directories on the system, we want to use this user only for ftp via lftp to read a certain file on the server ...
0
votes
0
answers
110
views
How can I set chown and chmod permanently, also for new files?
I installed texlive as usual in /usr/local/texlive/2025. When installing I typed umask 0027 prior to each command (./configure, make...), hoping that the resulting files would have root as owner and ...
8
votes
5
answers
5k
views
Why is chmod 777 so bad if I'm the only user on the system?
I hear that chmod 777 is a horrible idea. However, nobody else is ever going to use my system (and this is a quite common scenario for a lot of *nix systems). Why shouldn't I allow everything?
0
votes
0
answers
33
views
Full access shared folder for two unprivileged users
I am an unpriviledged user A in the same group G as another unpriviledged user B. We want to share a directory. I want to create a shared folder, be it /tmp/shared. How do I set its rights? Seems I ...
1
vote
2
answers
199
views
sudo chown: pemission denied even if I'm the owner [duplicate]
Could someone explain this?
john@john-pcRefs:~/pCloudDrive/someFolder$ ls -al
total 16
drwxr-xr-x 2 john john 4096 Jan 11 2022 .
drwxr-xr-x 4 john john 4096 Jan 11 2022 ..
-rw-r--r-- 1 john john ...
0
votes
1
answer
97
views
user unable to write to media | Permission denied
I am having a problem utilizing a mounted drive
on my Raspberry Pi 2B running Diet Pi.
dietpi@DietPi:/media/dietpi/Other$ sudo chmod 666 -R /media/dietpi
dietpi@DietPi:/media/dietpi/Other$ touch text....
0
votes
1
answer
125
views
What does `sudo chmod -R a=,a+rX,u+w,g+w /data` do?
What does the following command do?
sudo chmod -R a=,a+rX,u+w,g+w /data
I understand that it changes permissions, but what exactly and how?
0
votes
3
answers
115
views
What security advantage does executing privileges have?
Say some sysadmin has no problem with their users reading the files in /sbin, but doesn't want them running them. Take for example /sbin/initOne rebellious user used ld.so /sbin/poweroff instead. ...
0
votes
1
answer
345
views
Have drwxrwxrwx permissions on folder, but after mounting to it it becomes drwxr-xr-x which disalows members of the group to write. How do I fix it?
I have a folder under /mnt/ with drwxrwxrwx permissions and under root:root
I then mount a USB drive (exFAT) to this folder and it becomes drwxr-xr-x
The issue is that now I cannot scp to that folder ...
0
votes
3
answers
102
views
Keeping owners in a folder copy
I'm trying to copy a folder (SRC) containing some files and subfolders.
The content and SRC itself have setgid bit enabled (that is the s in place of the x in the group triplet). Furthermore, the ...
5
votes
1
answer
704
views
Root couldn't write to file with rw permissions for all users and owned by other user
I have script that can be runned from different users on the same machine. This script should write logs to the same file on every run.
Minimal version of script:
#!/usr/bin/env bash
...
0
votes
1
answer
503
views
Files created by user in a mounted partition show root as owner
I have a dual boot system (Windows 10/Archlinux) and I have created a NFTS partition which is mounted at startup via /etc/fstab so I can access it from both OS'es.
The fstab file shows that the ...
5
votes
3
answers
2k
views
What's the difference between mounting a drive with rw and chmod +rw?
I know that mounting a drive with "rw" would mount the file system as read/write, but what does that even mean? What's the difference between setting read and write via chmod?
0
votes
1
answer
84
views
Why is the sticky bit mentioned twice in chmod but only once in the ls output?
My task was to configure a directory so that users in a group could only delete files they own.
I used chmod 1771 RandD, as suggested by lab instructions, to accomplish this.
When running ls -l, the ...
0
votes
1
answer
710
views
Cannot login normally after login loop
I recently had a login loop that kept sending me back to the login screen no matter how many times I entered the correct password. I decided to login accessing the terminal directly by pressing cntrl+...
1
vote
1
answer
52
views
Is there a standard way of making a copy of file/folder permissions to apply/compare later?
I'm copying a bunch of files to a filesystem that doesn't support permissions. however, I will need to copy them to another filesystem which does support permissions a few years from now. at that ...
0
votes
0
answers
273
views
Linux Ubuntu 20.04 - ownership changed to root for entire drive - permission changed to 777 for all files, cannot revert
I am running Linux Ubuntu 20.04 and for some reason unknown to me, one of my storage drives suddenly has changed ownership to root and all file permisions are read/write/execute for all users. A ...
0
votes
1
answer
120
views
Why is chmod working inconsistently between files?
I am making 3 sites in Drupal and need to frequently change the settings.php file in each website folder. This file is read-only for security reasons by default, so before I can edit it, I use:
chmod ...
3
votes
2
answers
1k
views
Not able to give write permission to other user with ACL or chmod
Anyone know why rocky can't write to /tmp/afile? Giving rocky permission as an other user with chmod o+w doesn't seem to work either 🤔
I updated the acl with: setfacl -m u:rocky:rw /tmp/afile
id as ...
0
votes
0
answers
1k
views
Nginx Permission denied
I am using Nginx to serve static files from server. Static file is located in root folder, /server/cdn. I give all permission to this folder with sudo chmod 777 -R server command. Also I changed the ...
0
votes
1
answer
60
views
Does Linux clear set-group-ID bit for a file is the group ID of the file doesn't match?
I was going through the amazing book The Linux Programming Interface. In that chapter 15, section 15.4 page no 304, it is written that:
For this reason, when an unprivileged process (one that doesn't ...
1
vote
1
answer
587
views
Why does adding a user and setting an SUID for it throws me the "Operation not permitted" error?
I am setting SUID for a new user tommy to run the same commands as root but it goes down like this:
[root@192 ~]# useradd tommy
[root@192 ~]# su - tommy
[tommy@192 ~]$ chmod u+s /usr/bin/ls
chmod: ...
1
vote
1
answer
1k
views
Allow user in group to access shared folder from another user
There are two accounts user1 and user2. I wish to share and give rwx access to my user1 /home/user1/Documents/ folder with user2. To do this, I have made a new group called sharedDocs. These are the ...
0
votes
0
answers
145
views
macOS ACL settings - unable to delete Time Machine backup left-over files
(macOS Ventura - MacBook Pro M1)
I have deleted Time Machine backup file manually!! (my bad). Now I am left with files in my .Trashes folder that I cannot delete, no matter what I try.
I have enabled ...