107
votes
ssh returns "Bad owner or permissions on ~/.ssh/config"
These commands should fix the permission problem:
chown $USER ~/.ssh/config
chmod 644 ~/.ssh/config
Prefix with sudo if the files are owned by different user (or you don't have access to them).
If ...
78
votes
Accepted
Why can I update a file owned by root using sudo vi, but not append a line to it with sudo echo "Thing" >> file?
Sudo elevates the process it calls, it does not elevate any of the current shell's processing like redirection, globbing, etc.
The file redirection >> /etc/httpd/conf.d/vhosts.conf is being ...
52
votes
Program file exists in /usr/bin, but cannot be used
/usr/bin/ngrok will be a symlink that points nowhere (or rather to a non-existing file). Check with ls -l.
42
votes
Accepted
php script can't access /tmp folder
I found off why, well, someone gave me the global hint.
It's neither the fault of php or tmpfs. The culprit was systemd and his security system PrivateTmp.
For those who get in the same issue that I ...
35
votes
Accepted
What is a S-X-X-XX-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXX-XXXX called in Windows security?
It's a SID, or Security Identifier. If it's showing the string rather than a "friendly name," it sounds like the new server doesn't recognize the account.
34
votes
Accepted
Restrict a Linux user to the files he owns
Put a restricted and immutable directory between the outside world and the protected files, e.g.
/
├─ bin
├─ home
│ └─ joe <===== restricted and immutable
│ └─ joe <== regular home ...
28
votes
Accepted
How to add a file to a docker container which has no root permissions?
There is likely a way to view and change the Dockerfile for tomcat, but I can't figure it out after a few minutes. My inelegant solution is to add this line before the chown:
USER root
If you want ...
23
votes
What is the most secure way to allow a user read access to a log file?
Just to expand a little on the above answers here is a real world use case.
I run the enterprise log analysis application Splunk on a Redhat box. It runs under the splunk user and splunk group. This ...
21
votes
Accepted
OSX mojave: "crontab: tmp/tmp.X: Operation not permitted"
The short answer:
Go to System Preferences > Security & Privacy and give Full Disk Access to Terminal.
The long answer:
Pull down the Apple menu and choose ‘System Preferences’
Choose “...
17
votes
ssh returns "Bad owner or permissions on ~/.ssh/config"
For me it was an issue with my user account not being the owner of the file
sudo chown myuser ~/.ssh/config
16
votes
Stop users from saving files with specific extension in specific directories
You can use the 'File Resource Server Manager' role.
Installation of this role is done from the "Server Manager".
After the installation, enter the 'File Resource Server Manager' mmc console, and ...
15
votes
Restrict a Linux user to the files he owns
There is an option which you might want to consider (depending how much work you want to do for that).
As others already posted, "normally" you cannot prevent someone with shell access to read world-...
15
votes
How to add a file to a docker container which has no root permissions?
Since Docker 17.09 one can use the --chown flag on ADD/COPY operations in Dockerfile to change the owner in the ADD/COPY step itself rather than a separate RUN operation with chown which increases the ...
15
votes
Copy file permissions, but not files in Unix
GNU cp knows the --attributes-only flag since coreutils 8.6
--attributes-only don't copy the file data, just the attributes
15
votes
Accepted
Nginx doesn't have permission to access files with the same ownership
The nginx user is not able to traverse the filesystem to reach the folder where you have placed your site. A user must have the execute (+x) permission on a folder in order to be able to traverse it. ...
14
votes
Copy file permissions, but not files in Unix
My version of cp doesn't have the --attributes-only flag, so I worked up this. Briefly tested on simple folders, YMMV.
$> ls
version1/
version2/
$> ls -l version1/1/a
-rw-rw-r-- 1 alex alex 0 ...
13
votes
What's the best way of handling permissions for Apache 2's user www-data in /var/www?
This question was asked again, and as discussed on meta, current best practices provides better approaches than there was available in 2009, when this was asked. This answer tries to give some current ...
13
votes
ssh returns "Bad owner or permissions on ~/.ssh/config"
If on Windows Subsystem for Linux (WSL) and you pointed your WSL home directory to your Windows home directory (not recommended!) then chmod has no effect. Before you can chmod the files mentioned in ...
13
votes
Accepted
Managing Security Groups for NTFS Permissions
Your thoughts are essentially what I do, and I've had a lot of success in managing things that way in complicated environments.
The solution to both of the question is that you create resource groups ...
12
votes
Accepted
chmod: changing permissions of 'myscript.sh' : Operation not permitted
Set the permissions before you build the image
chmod +x scripts/myScript.sh
docker build .
docker will keep the permissions when it copies the files.
12
votes
chmod: changing permissions of 'myscript.sh' : Operation not permitted
Changing permissions of files you do not own in Linux requires root access, and the COPY command is most likely copying the file as root. You can change back to the sonarqube user after fixing the ...
11
votes
Restrict a Linux user to the files he owns
I have found POSIX Access Control Lists allow as you, as the system administrator, to protect your users from the worst of their own ignorance, by overriding the regular user-group-other file system ...
10
votes
How to tell rsync do not check permissions
If you supply the -a flag -p is automatically included. If you specify --no-p all of the other options from -a remain intact.
10
votes
Accepted
How do I detect what is changing file ownership on Linux?
I think you can use audit for specific file/directory or you can write custom rule based on your requirement
auditctl -w <path to the file you need to monitor> -p war -k test
...
10
votes
Accepted
SFTP-server uploaded files having wrong rights
If an SFTP client does not specify permissions for uploaded files, the OpenSSH SFTP server assigns 0666 permissions to newly created files (minus the umask 0002 makes the 0664).
This is hard-coded, ...
10
votes
Accepted
What should be the right logs permissions for NGINX on CentOS?
On the files located in /var/log/nginx/ the rules have changed over the time (at least in my experience). Yet without more data I'm not comfortable giving a definitive suggestion. But I'll try.
NGINX ...
10
votes
Accepted
how can I mount a windows share with rw access?
You can set the local UID using mount options, example below. You can find out your UID by running the id -u command.
sudo mount -t cifs -o username=maazza,domain=MYDOMAIN,uid=1000 //192.168.123.2/...
9
votes
Accepted
Is ZIP archive capable of storing permissions?
From the unzip(1) manpage:
Dates, times and permissions of stored directories are not restored
except under Unix. (On Windows NT and successors, timestamps are now
restored.)
So yes, ...
9
votes
Accepted
How to tell the difference between "No such file or directory" and "Permission Denied"
Test the file instead.
test -e /etc/shadow && echo The file is there
test -f /etc/shadow && echo The file is a file
test -d /etc/shadow && echo Oops, that file is a ...
9
votes
Accepted
Are directories with mode `drwxrwxrwt` safe in /tmp on a *nix system?
drwxrwxrwt (or 1777 rather than 777) are the normal permissions for /tmp/ and not harmful for subdirectories in /tmp/.
The leading d in the permissions drwxrwxrwt indicates a a directory and the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
file-permissions × 936permissions × 232
linux × 203
windows × 93
user-permissions × 71
apache-2.2 × 58
network-share × 57
ntfs × 52
ubuntu × 50
windows-server-2008 × 49
php × 43
nginx × 41
access-control-list × 41
security × 40
windows-server-2008-r2 × 40
ftp × 35
active-directory × 34
filesystems × 33
windows-server-2012-r2 × 30
windows-server-2003 × 27
centos × 26
file-sharing × 25
debian × 24
apache-2.4 × 23
chmod × 23