Questions tagged [chown]

All about changing ownership of files.

Filter by
Sorted by
Tagged with
132
votes
6answers
106k views

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?
108
votes
2answers
278k views

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},...
82
votes
3answers
146k views

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

I have abused sudo. I have created a really really short life temporary directory that I wanted to share between some users for a few hours... and I named this directory /some/path/tmp Unfortunately ...
78
votes
3answers
70k views

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?
38
votes
3answers
492k views

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 ...
26
votes
2answers
74k views

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 ...
23
votes
3answers
19k views

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/...
23
votes
1answer
2k views

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?
21
votes
2answers
48k views

A quicker way to change owner/group recursively? [duplicate]

Currently, when I want to change owner/group recursively, I do this: find . -type f -exec chown <owner>.<group> {} \; find . -type d -exec chown <owner>.<group> {} \; But ...
19
votes
2answers
23k views

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.
18
votes
3answers
5k views

How fakeroot is not a security breach in Linux?

After reading some pretty nice answers from this question, I am still fuzzy on why you would want to pretend that you are root without getting any of the benefits of actually being root. So far, what ...
18
votes
2answers
2k views

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 ...
17
votes
5answers
36k views

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?
14
votes
2answers
5k views

chown removes setuid bit: bug or feature?

Steps to reproduce: germar@host:~$ cd /tmp/ germar@host:/tmp$ touch test && chmod u+s test && ls -la test -rwSr--r-- 1 germar germar 0 Nov 2 20:11 test germar@host:/tmp$ chown germar:...
14
votes
2answers
84k views

How to Change Owner of a Directory

EDIT: The problem was that Apple uses permissions to mark backups and prevents you from modifying them (probably a security feature). By using chmod -RN <dir> I removed ACL data from all the ...
13
votes
4answers
24k 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 ...
12
votes
2answers
34k views

scp and file owner

What are the reasons that could make a change in a file ownership after scp'ing it from one server to another? The file ownership changed from 'owner' to 'apache'. I used scp -p . The user 'owner' ...
12
votes
1answer
15k views

Git pull in a Linux environment changes the owner of the files

Why will every time I execute a git pull on my live server, the owner of the files be changed? I keep on manually doing a chown john:john index.php. What do I need to change so that, when I do a git ...
11
votes
4answers
10k views

Will there be always a pair of same UID and GID?

I have to change file/directory's ownership using chmod .I know only owners's username but want to change default group name simultaneosly . At this stage group name is not decided so I am putting ...
10
votes
4answers
22k views

Using chown $USER:$USER inside bash script

In a small bash script I'm running I am attempting to chown a new directory that is created. I've added: sudo chown $USER:$USER /var/www/$sitename sudo chmod 775 /var/www/$sitename after the line ...
10
votes
2answers
8k views

What is the point of chgrp? [duplicate]

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?
9
votes
1answer
17k views

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?
9
votes
1answer
6k views

What permissions one needs to run chmod, chown command on a folder/item?

I've always been running chmod/chown commands as a sudo user. But today I wondered if I don't use sudo, what permissions do I need to actually execute chmod/chown command on a folder/file? I've tried ...
9
votes
7answers
9k views

How to change the permission and group-owner of a file at the same time

For changing file permission, I know I could use chmod. For changing group-owner, I could use chgrp. However, if I want to change both permission and owner at the same time, any command I could use on ...
8
votes
3answers
3k views

Sed with inplace editing changes group ownership of file

I have shell (php) script that gets in touch with target file this way: inspects whether file and directory are writable with php 's is_writable() (I don't think that this is problem) does in-place ...
8
votes
2answers
20k views

How to properly recursively chown files (including hidden dirs)

This conundrum is caused by running git pull from root. There are various reasons for me to do so... I want my device to update code when booting up, and rc.local is run by root. It all works ...
8
votes
4answers
61k views

Root cannot change file permission or ownership

My direcotrory is root: pwd / I have the following dir: drwxrwxrwx 4 root root 81920 Jun 4 09:25 imr_report_repo NOTE: imr_report_repo is an NFS share. Here is the fstab listing for ...
8
votes
1answer
39k views

how do I mount a CIFS share so I can fully control the mounted volume on the client

It's a simple question: but I am in much pain over this situation, so here is the question: How can I "mount" a share so that a) the share is run on boot b) that I can control things like chown/chmod ...
7
votes
2answers
783 views

Can't remove a file with file mode bits a+rw

I have a file with the following file mode bits (a+rw): [0] mypc<johndoe>:~>sudo touch /tmp/test [0] mypc<johndoe>:~>sudo chmod a+rw /tmp/test [0] mypc<johndoe>:~>ls -l ...
7
votes
2answers
12k views

What does `chown root.root $file` mean?

I'm trying to install colordiff in a custom directory because I do not have sudo privileges. I did make the directories hard-coded in the Makefile as stated in the README, but I'm getting this error: ...
7
votes
1answer
2k views

Patch without changing owner and group

I've got a file owned by a non-root user: # ls -l example.php -rw------- 1 foo bar ... example.php I just applied a patch with a command like patch -p0 <<-EOF --- .../example.php.orig 2012-06-...
6
votes
5answers
2k views

Allow group to r/w in folder owned by a specific user

I have a group manager and an user user1. user1 will create a directory by example in the webserver path /var/www/user1Project. How to allow the group manager to r/w in any directory owned by user1 ?...
6
votes
1answer
3k views

chown only where needed / speedup chown

On a folder with millions of files this can take quite a long time: chown someuser -Rf /folder_with_lots_of_files/ How can I speed this up if 99.9% of those files already belong to someuser?
6
votes
1answer
9k views

Keep same file owner for newly created files

This question is regarding samba file access. I have created a folder A, and under folder A created two folders B and C. And also created three users A, B and C. User A has access to all three ...
5
votes
2answers
8k views

chown: missing operand after ‘root:users’

I try to change owner to root:users recursively below a directory, if owner is other than root:users. cd /dir/ find . \( ! -user root -o ! -group users \) -print0 | xargs -0 chown -vc root:users I ...
5
votes
2answers
5k views

If I change permissions on a tar file, will that apply to the files inside it?

I have a script that runs regularly via cron, that creates a tar.gz file for the purpose of backing up a directory. For reasons beyond my control, the only user who can execute the script via cron is ...
5
votes
2answers
5k views

Seems that chown is allowed to non root user

We are using LDAP authentication and probably another things that I did not understand well, in our company so maybe the following questions are result of this. I have found strange behavior of chown ...
5
votes
1answer
7k views

Show who a file is chowned to?

I can chown a file with chown myuser:mygroup /tmp/file, but how can I see who a file is already chowned to, or who already owns it? Something like chown --show-who maybe... How can I list the user ...
5
votes
1answer
319 views

Can't chown 0 (root) in Cygwin

This command: rm -f testfile && touch testfile && chown 0 testfile is failing in Cygwin with error: chown: changing ownership of 'testfile': Invalid argument Why?
5
votes
2answers
6k views

Fix files with ????????? permissions

I wrote a script to change permissions on all files in a directory: #!/bin/bash files=`find "$1"` for f in $files; do chown "$2" "$f" chmod 600 "$2" done Obviously, the second argument to ...
5
votes
2answers
6k views

How to grant a user rights to change ownership of files/directories in a directory

How do I grant a specific user the right to change user and group ownership of files and directories inside a specific directory? I did a Google search and saw that there is such a thing as setfacl, ...
5
votes
2answers
28k views

Chown permission denied on owned dir

I have following directory (/usr/local) rwxr-xr-x. 43 root root 4096 Jul 25 14:19 . rwxr-xr-x. 14 root root 4096 Feb 21 10:27 .. rwxr-xr-x. 2 root root 4096 Jun 28 2011 bin [...] rwxr-xr-x 1 ...
5
votes
3answers
2k views

How to add a second owner of a folder using terminal on Mac?

On Mac using terminal and "chown" command I can set owner for a folder like this: sudo chown -R _www somefolder However this replaces me with _www. I.e. I'm not in the list of owners anymore. I ...
5
votes
1answer
862 views

Change owner of own directory

I am fully aware that a non-root user cannot change the owner of a folder to another user even if the user owns it unless they use sudo or have the CAP_CHOWN capability. Is there a way to grant a ...
5
votes
1answer
4k views

Is there any way to use chown/chgrp without modifying the last modified date?

I'm recovering files from an old hard drive and I need to keep the last modified date from the drive. The reason they are updating is because I need to change the ownership of the files to a new user.
5
votes
0answers
6k views

NFS exports all_squash,anonuid,anongid mapping all client users to owner on server (working) still needs world readable permissions on the server?

My /etc/exports on the NFS server: /home/username/Documents/some/folders/deep 192.168.1.10(rw,sync,all_squash,anonuid=1000,anongid=1000) This seems to be working as intended for the most part. ...
4
votes
5answers
27k views

Create a file as a different user and group

I have a bash script that has to rsync to download files writing them locally, and then needs to set the owner to apache, and the group to a particular user group (that apache is not a member of). Is ...
4
votes
2answers
8k views

Change file ownership, based on previous owner

I am a moderately new linux user. I changed my PC, and started using CentOS 7 from CentOS 6. So I attached my previous hard disk to my new pc to take backup of my files. Now, copying the files (and ...
4
votes
2answers
3k views

Should /usr owner be root?

After having installed the MySQL database on openSUSE I realized that for all files in /usr/bin the owner was changed to the "mysql" user of the "mysql" group. Maybe there was some mistake of mine. ...
4
votes
3answers
315 views

How to prohibit from changing an owner of modifiable files?

I sometimes need to run a Qt Creator from root. After that, some config files of Qt Creator suddenly have a root as an owner. Therefore when running Qt Creator as user, I am getting nag warnings about ...

1 2 3 4 5