Questions tagged [chown]

All about changing ownership of files.

The chown command can be used to change the ownership of files and directories. Changing file ownership requires superuser privileges, or at least the CAP_CHOWN capability (see ).

There is also the chgrp commant to chang the group ownership of files. However, on Linux and most modern Unix systems chown can be used to change file ownership, group ownership, or both.

Use this tag if you question is related to changing ownership of files.

Note: the tags or probably apply as well or are even more appropriate.

External reference

chown specification (The Open Group Base Specifications Issue 7, 2018 edition)

279 questions
162
votes
3 answers

Mount cifs Network Drive: write permissions and chown

I have access to a cifs network drive. When I mount it under my OSX machine, I can read and write from and to it. When I mount the drive in ubuntu, using: sudo mount -t cifs -o username=${USER},password=${PASSWORD} //server-address/folder…
Vincent
  • 2,778
  • 6
  • 23
  • 28
155
votes
8 answers

Clone ownership and permissions from another file?

Is there a command or flag to clone the user/group ownership and permissions on a file from another file? To make the perms and ownership exactly those of another file?
user394
  • 14,194
  • 21
  • 66
  • 93
112
votes
3 answers

What are correct permissions for /tmp ? I unintentionally set it all public recursively

I have created a really really short life temporary directory that I wanted to share between some users for a few hours : /some/path/tmp Unfortunately I have launched sudo chown 777 -R /tmp instead of sudo chown 777 -R tmp, so my /tmp file is now…
Stephane Rolland
  • 4,147
  • 6
  • 37
  • 49
102
votes
3 answers

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?
phleg
  • 1,021
  • 2
  • 7
  • 4
63
votes
3 answers

Create file in folder: permission denied

I have a problem copying files to a directory on Ubuntu 12.04. I create a directory in the home directory so that the path where I want to copy to is: /home/sixven/camp_sms/inputs But when ini run the following command in the terminal to create a…
franvergara66
  • 1,119
  • 3
  • 10
  • 10
47
votes
2 answers

Is it possible to chown a file, based on numeric UID, to a user that does not yet exist?

For example, for managing a disk partition for another system where the user exists. I know I can simply create a user temporarily but I find this question interesting.
glarry
  • 904
  • 1
  • 7
  • 15
32
votes
2 answers

A quicker way to change owner/group recursively?

Currently, when I want to change owner/group recursively, I do this: find . -type f -exec chown . {} \; find . -type d -exec chown . {} \; But that can take several minutes for each command. I heard that there was a way…
danzo
  • 431
  • 1
  • 4
  • 5
32
votes
2 answers

Meaning of root:wheel

What does root:wheel mean in the following? chown root:wheel myfile
Casebash
  • 1,041
  • 2
  • 13
  • 20
31
votes
2 answers

What is the equivalent for 'www-data' for CentOs?

CentOs doesn't recognise www-data but want to change ownership on my files folder. All my folders are owned by root at the moment. Confused as to what should be owned by apache and what she be owned by me the root user? Also when it says root root…
freja
  • 697
  • 5
  • 12
  • 20
30
votes
3 answers

Move files and change ownership at the sametime

On Linux (Debian, Ubuntu Mint...), Is there any option command or something that I can use to transfer files to another user without having to do : sudo mv /home/poney/folderfulloffiles /home/unicorn/ sudo chown -R unicorn:unicorn…
Kiwy
  • 9,415
  • 13
  • 49
  • 79
29
votes
2 answers

If chown can change groups, why was chgrp created?

So there's chown which lets you change the owner and group of files and/or directories. But there's also chgrp which only changes the group. Why was chgrp created? Isn't it redundant?
dayuloli
  • 515
  • 4
  • 14
21
votes
6 answers

How to revert chown command?

If I run: sudo chown -R user:user / Can I revert it to what it was before I ran it?
fronthem
  • 4,957
  • 6
  • 24
  • 31
21
votes
1 answer

How to perform chown and chgrp in one command

In order to change both a file's owner and group we can do this: chown trump file chgrp trump file but can I do both commands in one approach or one command?
yael
  • 12,598
  • 51
  • 169
  • 303
21
votes
2 answers

What is the point of chgrp?

I know what chgrp and chown do. My question is since chown does the same thing as chgrp (and even more), what is the point of chgrp?
user2739974
  • 311
  • 1
  • 2
  • 3
19
votes
2 answers

explanation on chown(1) POSIX spec

The POSIX spec for the chown utility mentions in its rationale section about the chown user:group syntax (formerly chown user.group) (emphasis mine): The 4.3 BSD method of specifying both owner and group was included in this volume of POSIX.1-2008…
Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501
1
2 3
18 19