For questions related to file ownership in Unix/Linux operating systems.
Questions tagged [ownership]
101 questions
14
votes
5 answers
Best way to only list files that I own
What would be the best shell command "one liner" that I could use to list all of the files in a directory, only showing those that I own?
James
- 141
- 1
- 1
- 3
13
votes
2 answers
How can I use commands with sudo without changing owner of the files?
When I use sudo to do some activities with files, these files change ownership.
How can I use commands with sudo without changing owner of the files?
Example file archivos35.sh is from apache but I use sed (with usr admin sudo)
$ ls -l
-rwxr-xrw-. 1…
Dok Gus
- 131
- 1
- 3
12
votes
4 answers
chmod and chown at the same time?
I have a script I'm running to fix file ownership and permissions after an rsync. Questions of the optimal way to do my task aside, I wonder, is there a way to run chmod and chown at the same time?
In the current iteration of my script, I'm finding…
user394
- 14,194
- 21
- 66
- 93
11
votes
2 answers
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 server are owned by the user tomcat, and in the…
Leonel
- 211
- 2
- 5
8
votes
1 answer
Filesystem mounted as root but owned by user. Why?
I'm mounting a filesystem as root and I don't understand why it is not owned by root but by an unprivileged user.
Here's fstab:
cat /etc/fstab
[...]
/dev/sdb /mnt/projects ext4 defaults 0 2
And here's what happens when mounting:
ls -al…
Jérôme
- 1,898
- 3
- 26
- 47
7
votes
3 answers
Cannot rename resolv.conf file as root
I am trying to activate NordVPN CyberSec by completing the following instructions in Debian 9.
I should be able to do the changes as root and with sudo like described for Ubuntu in the thread Should I edit my resolv.conf file to fix wrong DNS…
Léo Léopold Hertz 준영
- 6,788
- 29
- 91
- 193
6
votes
2 answers
Copying a file into a directory where I am a member of the directory group
I am attempting to copy a file into a directory where my user account is not the directory owner but belongs to a group that is the directory group owner. These are the steps I have taken:
Create a group and add me to that group
stephen@pi:~ $ sudo…
Stephen Mitchell
- 63
- 4
5
votes
2 answers
What are the standard ownership settings for files in the `.gnupg` folder?
What are the standard ownership settings for files in the .gnupg folder?
After doing sudo chown u:u * mine now looks like this:
drwx------ 2 u u 4,0K jan 18 22:53 crls.d
drwx------ 2 u u 4,0K jan 18 22:33 openpgp-revocs.d
drwx------ 2 u u 4,0K jan…
PetaspeedBeaver
- 1,207
- 3
- 15
- 32
5
votes
4 answers
Restore file ownership after running chown by accident
I recently upgraded my PostgreSQL installation and intended to run the command:
sudo chown -R postgres:postgres /var/lib/postgres
Unfortunately, I accidentally forgot the “postgres” part at the end because of a miscalculated tab completion... I…
Goodies
- 151
- 1
- 4
5
votes
1 answer
Cannot change permissions as root on a file owned by root
The problem is that I have PHP files that do not work in the browser. I suspect because the user is missing read permissions.
The files are located in a dir called "ajax"
drwxrwxrwx. 2 root root 4096 Sep 13 14:33 ajax
The content of that…
Thomas
- 171
- 3
- 12
4
votes
2 answers
Allow rsync to be run remotely as root, but only to read files. A read-only root user?
I would like to use rsync-over-ssh to pull backups from many remote traget machines to a central backup.
I could do this as the root user, but that would allow me to accidentally run a bad rsync command which wrote to, or deleted from, a machine…
fadedbee
- 797
- 1
- 5
- 23
4
votes
4 answers
hdd mount option to grant ownership of files on drive
I have 5 internal drives and 3 external.
I would like the internal drive's files to be owned by my default user hutber
I have tried to chown them with sudo as seen here:
It looks successful, however
I am unsure if its possible to change, but here…
Jamie Hutber
- 121
- 3
- 7
- 17
4
votes
1 answer
Delete a directory owned by me, containing files not owned by me
I have a directory in my home folder containing some build output, which the build process has chown to another user (for reasons unknown to me.) I want to delete the directory, but can't because it's not empty, and I can't delete the files it…
Brent
- 214
- 2
- 8
4
votes
1 answer
Create, as a regular user, a tar with files owned by root
I want to build a tar file as regular (non-root) user with some prepared binaries and configuration files like this;
etc/binaries.conf
usr/bin/binary1
usr/bin/binary2
that are mean to be extracted into the file system under the / directory.
Like a…
carpinchosaurio
- 333
- 3
- 15
3
votes
2 answers
Change owner and group for specific owners only
My apologies for the silly/simple question - yet after searching the web and SE, I cannot find an answer for this specific issue.
Question:
How does one change the owner and group (system-wide) only for files owned by a specific owner?
Use-case:
We…
S3DEV
- 193
- 1
- 7