chown is a command is used to change the owner and/or group membership of a file or set of files.
Questions tagged [chown]
374 questions
12
votes
2 answers
Installing Mongo and chown /data/db yields "illegal user name" error
I'm installing MongoDB for a Node / Express tutorial and upon creation of the /data/db folder and the following command:
sudo chown 'id -u' /data/db
I received the following error:
chown: id -u: illegal user name

phillipmaddox
- 372
- 4
- 5
- 16
9
votes
1 answer
chown docker volumes on host (possibly through docker-compose)
I have the following example
version: '2'
services:
proxy:
container_name: proxy
hostname: proxy
image: nginx
ports:
- 80:80
- 443:443
volumes:
- proxy_conf:/etc/nginx
-…

Morpheu5
- 2,610
- 6
- 39
- 72
8
votes
1 answer
Used chown for /var/lib/mysql to change owner from root, now getting Error 1049 (42000) in mysql
With Ubuntu, I previously created a mysql database using the following code in the terminal:
$ my sql -u root -p
Then within mysql:
CREATE DATABASE securities_master;
I was trying to use file explorer to view the contents related to this database.…

Wei
- 428
- 1
- 5
- 13
8
votes
11 answers
/usr/bin/sudo must be owned by uid 0 and have the setuid bit set version .ubantu14.04 LTS
when I set the EACCESS for npm and I was ran the chown command in my terminal for change owner permission but now i stuck in this
sudo :" /usr/bin/sudo must be owned by uid 0 and have the setuid bit set" my version is : ubuntu14.04 LTS please help…

Chirag thaker
- 323
- 2
- 4
- 15
8
votes
3 answers
List too long to chmod recursively
I have tried the following command to chmod many images within a folder...
chown -R apache:apache *
But i get the follwing error
-bash: /usr/bin: Argument list too long
I then tried ...
ls | xargs chown -R apache:apache *
and then get the…

William
- 141
- 1
- 2
- 9
7
votes
5 answers
chown: /usr/local: Operation not permitted - issue with brew update /usr/local is not writable - MacOS 10.13.1 high sierra
I am unable to do brew update because I can’t chown /usr/local:
$ brew update
Error: /usr/local is not writable. You should change the ownership
and permissions of /usr/local back to your user account:
sudo chown -R $(whoami) /usr/local
based on…

Axil
- 3,606
- 10
- 62
- 136
7
votes
1 answer
Why do my setuid root bash shell scripts not work?
I created this simple script to allow the user to remove files created by the web server in his home directory without giving him "su". Both scripts are set with "chmod 4750".
The craziest thing is that they DID work and now they don't. Here's the…

Bob
- 71
- 1
- 1
- 3
7
votes
1 answer
Granting user permissions using sudo chown -R $USER:$USER /dir/ectory/
I am following this tutorial: How To Set Up Apache Virtual Hosts on Ubuntu 14.04 LTS.
I get an error on: Step Two — Grant Permissions which states the following:
Now we have the directory structure for our files, but they are owned
by our root…

shhasan
- 453
- 2
- 9
- 21
7
votes
3 answers
Should Vagrant require sudo for each command?
My question in short: I run into permissions error every time I execute any Vagrant command without 'sudo' - from vagrant up to vagrant provision. Is this expected…

Petr Cibulka
- 2,452
- 4
- 28
- 45
7
votes
3 answers
Node.JS: Alternative to chown string
At this time, fs.chown requires int values for uid and gid.
So, what is the recommended way to get these int values from a UNIX-like system?
Should I read /etc/passwd and /etc/group directly?
That does not seem like the right way to do it...

700 Software
- 85,281
- 83
- 234
- 341
6
votes
1 answer
docker-node: Running as non-root user, file permissions
Following docker-node’s best practices, I want to run my node app as non-root user. The recommendation is as follows:
FROM node:6.10.3
...
# At the end, set the user to use when running this image
USER node
My simplified Dockerfile currently looks…

qqilihq
- 10,794
- 7
- 48
- 89
6
votes
2 answers
Changing ownership of ‘/usr/bin/’: Operation not permitted
I have just made a huge mistake by changing the owner of my /usr/bin from root to an ordinary user. Whenever i try to execute $sudo chown root /usr/bin this gives me :
chown: changing ownership of ‘/usr/bin/’: Operation not permitted
I have read…

user-x220
- 151
- 1
- 3
- 9
6
votes
4 answers
PHP mkdir and apache ownership
Is there a way to set php running under apache to create folders with the folder owned by the owner of the program that creates it instead of being owned by apache?
Using word press it creates new folders to upload into but these are owned by…

Bill H
- 63
- 1
- 1
- 3
6
votes
3 answers
Change owner of the root folder and subfolders (Ubuntu 13.04)
I accidentally set owner of root folder (/) and all subfolders to one user by command
$ sudo chown -R 'userName' /*
Now I wanna set owner back to root user by command
$ chown -R root:root /*
But I have no permission for this operation.
If i use…

Mikhail Panteleev
- 133
- 1
- 3
- 12
5
votes
3 answers
How to preserve ownership and permissions when doing an atomic file replace?
So, the normal POSIX way to safely, atomically replace the contents of a file is:
fopen(3) a temporary file on the same volume
fwrite(3) the new contents to the temporary file
fflush(3)/fsync(2) to ensure the contents are written to disk
fclose(3)…

Daniel Pryden
- 59,486
- 16
- 97
- 135