Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [chown]

All about changing ownership of files.

Filter by
Sorted by
Tagged with
0 votes
1 answer
18 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 ...
Duxa's user avatar
  • 103
0 votes
1 answer
29 views

How to set back file ownership from a reference (/etc) directory to a copy on Linux?

Context : Debian 12 system recovery trial after a btrfs file system corruption (roots tree) with no backup but access to all(?) the files. I made a copy of the system after the corruption, everything ...
lalebarde's user avatar
  • 255
5 votes
1 answer
488 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 ...
armoken's user avatar
  • 53
2 votes
1 answer
66 views

chown cannot dereference, Permission denied

Given, touch /tmp/abc ln -vs abc /tmp/def $ ls -l /tmp/??? -rw-rw-r-- 1 ubuntu ubuntu 0 Apr 10 22:10 /tmp/abc lrwxrwxrwx 1 ubuntu ubuntu 3 Apr 10 22:10 /tmp/def -> abc Why I'm getting: $ sudo ...
xpt's user avatar
  • 1,614
0 votes
0 answers
21 views

Chown accident, everything owned by user "bunchy7s" [duplicate]

Wanted to do chown -r bunchy7s /var/lib/jellyfin, I however forgot the var/lib/jellyfin part. now everything is owned by bunchy7s! :) and nothing works how you would expect! Yay!
bunchy7s's user avatar
3 votes
1 answer
253 views

Why does chown reset/remove the SUID bit and reset capabilities?

This command: sudo chown -R root:root directory will remove the SUID bit and reset all capabilities for files. I wonder why it's done silently and it's not mentioned in the man page. Weirdly the GUID ...
Artem S. Tashkinov's user avatar
1 vote
0 answers
32 views

ACL always sets group execute permissions on files (Samba)

I have some users in the "sambashare" group and some in the "sambashareAdmin" group. Only users from the "sambashareAdmin" group are alowed to change/create stuff. All ...
MrGlasspoole's user avatar
0 votes
0 answers
36 views

Linux recursive permission inheritance

I am wanting to allow file/folder permission inheritance. On my machine, I want some directories to belong to some user/group. This is achieved by running: sudo chown my_user:my_group my_directory. A ...
clank's user avatar
  • 1
0 votes
0 answers
21 views

Set group and mod of a new directory

I try to set for NEW created files/directories in /home/test: group to "test" right to "770" This works for the group (1). chown :test /home/test chmod g+s /home/test But I do ...
chris01's user avatar
  • 595
0 votes
0 answers
62 views

restore root ownership of files from a mounted file system

I have a /dev/nvme0n1p3 ext4 partition where I have installed ubuntu 18.04 My personal files are at /home/sas/data I created a different /dev/nvme0n1p2 ext4 partition, where I installed ubuntu 22.04 ...
opensas's user avatar
  • 111
0 votes
1 answer
49 views

How do I mount attached drive /home or something similar on VPS

I obtained a VPS and they attached a 16TB HDD... They gave me a guide to mount the HDD to folder /hdd. My issue is that the program I am installing on a sudo user has a lot of small apps that get ...
Nanja's user avatar
  • 1
2 votes
2 answers
316 views

How to conditionlly change ownership of a file?

I was tasked to change the owner of a file called hello to vincent only if the owner was guillame. I tried to use chmod vincent:guillame hello but this is not working. Please, I need help to solve the ...
Westfiree's user avatar
0 votes
1 answer
113 views

docker-compose fails to change ownership on ubuntu 22.04.3 on VMware Workstation

VMware Workstation: 16.2.5/17.0.2 Ubuntu: 20.04.6/22.04.3 Dockerfile: FROM debian:12.1-slim WORKDIR /root RUN groupadd -f ernie-1001 -g 1001 \ && groupadd -f ernie-1000 -g 1000 \ &...
Ernie Sanderson's user avatar
0 votes
0 answers
463 views

`chown` not working, even using sudo

I am getting this error from git: fatal: detected dubious ownership in repository at '/run/media/marcel/Хранилище/Dev/Desktop/SimpleAccent' To add an exception for this directory, call: git ...
MrArsikk's user avatar
-3 votes
2 answers
127 views

Trying to transfer files from my ubuntu server (running in oracle cloud) to my windows pc via pscp.exe

i did some mess and I'm trying to rescue some files from my ubuntu server to my local windows 7 client. Option WinSCP: Unfortunatelly WinSCP does not work anymore since I made the mess. (I run the ...
jjx's user avatar
  • 9
0 votes
2 answers
306 views

I run a wrong "chown -R /" command. Anything I can do to undo or minimize the impact? [duplicate]

i wanted to change the ownership of one specific folder and I think I messed it up. I run following command: sudo chown -R ubuntu / (I was thinking it will only change the folder I was located in) ...
jjx's user avatar
  • 9
0 votes
1 answer
128 views

Which first level directories in Linux should be owned by user?

Today, I have accidentally noticed that the following directories of the / are owned by user, rather than root: /home /lost+found /media /mnt /opt /snap /srv /swapfile /var I have no idea how that ...
S. N.'s user avatar
  • 287
0 votes
0 answers
172 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 ...
UsernameError's user avatar
0 votes
0 answers
1k views

Different user other than "USER root" in Dockerfile while executing crucial "RUN apt-get..." commands

I recently experienced a Mass Email attack where someone "sniffed" my email and was using it as a "From:[email protected]" in the mass attack. I believe my email info get sniffed ...
python_mainly's user avatar
1 vote
1 answer
212 views

Owner changed to _apt systemd-journal

For some unknown, mysterious reasons, most of the folders on my debian have been switched from root:root to _apt:systemd-journal arthur@debian:~$ ls -la /data/tera_4/Content/ total 32 drwxrwxr-x 8 ...
Arthur Attout's user avatar
0 votes
1 answer
82 views

Strange behavior of the mount dir when mount an EFI partition in a virtual block device (loop device)

In my WSL2 Debian distro, I created an image file named VirtDisk.img and set it as a virtual block device: dd if=/dev/zero of=VirtBlock.img bs=1G count=16 16+0 ...
Color Glass's user avatar
0 votes
1 answer
37 views

How to keep ownership to same user for dir

I have two users,memsql and 4px. I have copied dir from 4px user, home dir to memsql user home dir. I want the permission for dir poc & singlestore1 to be memsql , memsql. Instead of memsql & ...
Divyank's user avatar
  • 137
3 votes
0 answers
640 views

Speed up chown for very large codebase

We have a scenario where we need to chown <group>:<user> on a LInux machine frequently for large sandboxes which contain thousands of directories/subdirectories, textfiles, object files, ...
tony's user avatar
  • 61
1 vote
3 answers
349 views

Is there any way to change file owner when some user modify the file?

For example, user1 create file. That file's owner is user1. if user2 modify that file's contents and save it. After that, file's owner changed to user2. is it possible? if possible how can do that? (...
DarkerBlack's user avatar
0 votes
1 answer
153 views

replacing explicit user names with variables in mkdir and chown

What specific changes need to be made in the commands below in order to use a variable username and a variable user_home to create a subdirectory within the current user's home and then to change ...
CodeMed's user avatar
  • 5,239
1 vote
1 answer
3k views

Does chown command allow to set group different from user group?

It may be a stupid question, but I don't understand a detail about the command chown. I haven't found any explanation for this detail yet, maybe because it's so obvious to everyone. When you change a ...
SuperFluo's user avatar
0 votes
1 answer
188 views

change group ownership specifying from to for entire file system

I have 3 specific user accounts (less than 10 anyway), for all files & folders under a specific /data or /home directory, I want to change just the group ownership of all occurring files/folders ...
ron's user avatar
  • 6,817
1 vote
1 answer
289 views

My files are created with the wrong owner [duplicate]

In my case when I create a file or folder as user ludow the owner of the file or folder is root exemple ❯ whoami ludow ❯ touch test ❯ ls -al | grep test -rwxrwxrwx 1 root root 0 30 oct. 21:02 ...
Ludo's user avatar
  • 13
0 votes
1 answer
94 views

How do I have two group owners

I have a file where I want there to be not one but two groups who can have extra privileges to access it. But when I chown or chgrp it to a group it always erases the previous group. How do I add a ...
ConcernedParagraph7235's user avatar
0 votes
2 answers
2k views

Mounting an external disk changes permissions on mount point directory

On Debian 11, mounting an external disk changes permissions on the mount point directory. The disk is formatted as ext4. Is this normal behavior? Create directory: user@debian:/media$ mkdir external2 ...
NoExpert's user avatar
  • 489
1 vote
1 answer
3k views

Is there ever a good reason to add users to the "root" group?

There is much discussion online about creating sudo users and groups, editing the sudoers file, etc. For example, you might have sensitive configuration files or shell scripts, and you set the file ...
Jesse Nickles's user avatar
3 votes
2 answers
822 views

Can't `chown` with `unshare`

I run unshare -r touch file. However, unshare -r chown nobody file gives me Invalid argument. Why?
DrownedSuccess's user avatar
2 votes
1 answer
151 views

why chgrp or chown command causes file loss xattr

[root@localhost ~]# getfattr -m - -d /bin/tcpm getfattr: Removing leading '/' from absolute path names # file: bin/tcpm security.capability=0sAQAAAgAUAAAAAAAAAAAAAAAAAAA= security.selinux="...
Lee Bruce's user avatar
0 votes
0 answers
169 views

How to expand the number of subuids for a linux namespace

After running something like this: $ unshare -rUm $ mkdir opt $ mount --bind opt /opt $ touch /opt/test $ chown 1000:1000 /opt/test I'm receiving this: chown: changing ownership of '/opt/test': ...
Marius's user avatar
  • 1
0 votes
1 answer
115 views

Do group permissions matter for files owned by the root group?

I've stumbled upon a script which included the following two commands: chown -R some-user:0 /some/dir chmod -R g+w /some/dir Specifically, this is from the Dockerfile of the nginx-unprivileged Docker ...
JMC's user avatar
  • 195
0 votes
1 answer
164 views

Why did chown mess up my sudo.conf?

My machine has 2 NVMe drives. During install, I loaded everything onto one of them and left the 2nd one untouched. I figured this would be a good way to learn about mounting drives after install. So I ...
AZDeveloper's user avatar
-3 votes
1 answer
154 views

how to enable ownership of all devices? [closed]

The Linux security goes OVERBOARD when there is a single user , hardware never to be accessed by public , strictly home operation. Adding simple USB flash drive turns into exercise in futility... ...
anne's user avatar
  • 47
1 vote
3 answers
795 views

Script to CHOWN all the files in a dir but skip a specific dir inside

so i have this startup script i run after re OSing my server: Installs drivers Mounts Zpool Adds users and smb users and SMB shares. The only things that survives the new OS is my Zpool of which ...
nope none's user avatar
0 votes
2 answers
429 views

Broke file permissions and can no longer load webpages on server

I noticed an unusually large number of SSH attempts on my server so disabled the root login for SSH, created a new sudo user and confirmed I was able to log in without issues and elevate myself to the ...
Alex's user avatar
  • 61
0 votes
2 answers
2k views

Why does the 'chown' command does not work recursively using the '-R' flag for directories owned by the user nobody?

System: x86_64 Linux 5.13.19-2-MANJARO. I have a weird directory in '~/.local/share/Trash/expunged' which contains a few directories owned by the user nobody. I tried to execute the following command ...
David Scholz's user avatar
1 vote
1 answer
368 views

a disk moved from an old computer requires a root user to be mounted, why?

I had a data disk on my previous computer (Debian 9) accessible to me, the user marc. Then I bought a new computer (Debian 10), and the reseller put that disk among others, that was immediately ...
Marc Le Bihan's user avatar
0 votes
0 answers
287 views

How to insert new users directories

I am trying to set up the directories on Ubuntu Server, Linux 4.15.0-162-generic #170-Ubuntu SMP using command chown user:group however, I have gotten an error like chown: invalid spec: ‘2163147:’ ...
Rodrigo N M's user avatar
1 vote
0 answers
28 views

Did I lose my files or are can I just not see them after installing Mint 20?

I have 2 HDD and I (maybe incorrectly) chose the format option when I installed the Mint 20. I was thinking that the files on the second HDD would be preserved. I can't see them after the upgrade. It ...
Jon Bassett's user avatar
3 votes
1 answer
6k views

How can I change the permission of an external hard drive and access it?

I try to access an external hard drive with an ntfs filesystem from NixOS. Is it correct that I have to create a mounting point? Where do you usually create a mounting point? sudo mkdir -p /media/b/...
Ben's user avatar
  • 111
1 vote
0 answers
113 views

Run clang-format from rootful container on bind-mounted host dir without changing ownership

I want clang-format run from within a container on a bind mounted host directory to keep the ownership of modified files. I have a simple Dockerfile which I'm running with podman. I bind mount the ...
user2183336's user avatar
3 votes
1 answer
1k views

Permissions of all files and directories in /usr

Oh my.. I just did a terrible mistake: chown -R root:root /usr. Mea [maxima] culpa.. I fixed sudo and pkexec already, but I want to be sure, there is no "sleeping" issue waiting on me in the ...
Fantastic Mr. Fox's user avatar
0 votes
0 answers
694 views

permission confusion when trying to tail logs

I would like to tail my radius logs with my user but I get the following: ron@OldNotebook ~ [1]> sudo ls -l /var/log/radius/radius.log -rw-r--r-- 1 radiusd radiusd 147918 Jun 22 15:04 /var/log/...
Testix's user avatar
  • 73
0 votes
1 answer
590 views

Linux file permission confusion [duplicate]

My home folder contains 2 users. 1 admin users and 1 guest. I basically want a guest user not to be able to change the directory to a directory outside his own home folder when he logs in via SSH ...
MajesticOl's user avatar
0 votes
1 answer
803 views

Mounting the Drive to the Raspberry Pi and changing DIR ownership

so, after having followed this guide here https://pimylifeup.com/raspberry-pi-mount-usb-drive/ I've ended up with an automatically mounted external fat32 drive but now the ownership of that folder it ...
Kerberos's user avatar
0 votes
2 answers
37k views

chmod to change permissions of specific user

I have two users, user1 and user2. I also have a file in /path/to/file. user1 should be able to have read-write access, while user2 should only have read access. I know that I can change permissions ...
Legatio's user avatar
  • 175

1
2 3 4 5 6