Questions tagged [chown]

All about changing ownership of files.

Filter by
Sorted by
Tagged with
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?
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 ...
2
votes
1answer
3k views

Symbolic link not working as expected when changes user

Symbolic link not working, using standard UBUNTU 16 LTS... It shows "Permission denied" where I expected to get access, not working even after chown. Full example: sudo rm /tmp/file.txt # if exist, ...
1
vote
4answers
3k views

Accidental chown under / as root

I accidentally run the following command as root chown mike -Rf / backups the point is that I added a space between / and backups my mistake, I stopped the command after 1-2 seconds, how can I recover ...
108
votes
2answers
277k 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},...
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?
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?
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?
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 ...
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 ...
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 ...
2
votes
1answer
1k views

Recovering from a chown -R / [duplicate]

I've made today the greatest error on my server using root user: chown -R 33:33 / instead of chown -R 33:33 . within some webroot folder. Well, this brought ssh down. I made it this far to get it ...
2
votes
1answer
185 views

Owner of directory set to 518?

I recently installed some PHP site on a server for a customer. A guy calls me up and tells me he can't seem to upload to the img directory. I went in and took a look at the owner of said directory. ...
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:...
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 ...
2
votes
2answers
732 views

How come I, as a normal user, am able to change ownership of a file?

I have a partition that's NFS-mounted from a Netapp SAN. I can create files in that partition, and I can chown those files to another user, any user, even root. How am I able to do so? I thought the ...
1
vote
1answer
2k views

Safe to change owner of OS X system folders?

I'm trying to get Homebrew to work. That program's diagnosis tool gives me these suggestions: You should probably chown /usr/local/etc ... You should probably chown them: /usr/local/...
7
votes
2answers
772 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 ...
4
votes
2answers
6k views

Taking file ownership when file and directory is readable/writable

I got some files in directory: drwxrws-wt 2 me mygroup 4,0K 10.1. 12:34 . -rw-r----- 1 someone mygroup 10G 10.1. 11:22 someonesfile me and someone are regular users without supplementary ...
3
votes
1answer
469 views

Within fakeroot, why does chown return EPERM even though it succeeds (but then again it didn't)?

I've been running into bizarre behavior when using chown(2) within a fakeroot environment. The following minimal program illustrates the issue: #include <fcntl.h> #include <stdio.h> #...
2
votes
2answers
802 views

Change Owner of Folder in SCO

How can I change the Owner/group of a folder in SCO? I did: ls -l and got the following: ... drwxr-xr-x 9 root root 512 Jul 2 10:09 opt ... I have tried: chown /opt But that hasn't worked. The ...
2
votes
1answer
15k views

Changing user and group ID system wide (including file system attributes)?

(this question possibly related to Linux: simulating/masking user ownership upon mount of 'external' partitions? - Stack Overflow) I typically use Ubuntu (currently 11.04) as my desktop OS; let's say ...
2
votes
1answer
3k views

Setting up permissions for common folder

I am trying to setup a little home network using Linux as the File Server and have run into a bit of problems w.r.t. to folder permissions that I can't seem to solve. The setup: An Ubuntu 14.04 Linux ...
2
votes
2answers
481 views

changing owner UID selectively for 10 users on a 10+TB directory

I have a 10+ TB NFS /home for 100+ users plus public folders. I need to change the username and UID of 10 of those users. At first, I was thinking of running the following: find /home -uid 812 -exec ...
1
vote
1answer
5k views

Change ownership of a share drive

I have a windows machine locally connected to my linux machine. There is a shared folder on the windows machine, which I mounted on my linux machine using sudo mount -t cifs -o username=myuser //xxx....
0
votes
1answer
82 views

changing folder ownership, operation permitted, also as root

I have 2 moxa computers (Debian 9) with both an SD card installed. the problem is with one computer's SD card mounting. I can not change group ownerships /dev/mmcblk0p1 /media/sd-mmcblk0p1 vfat rw,...