Given a linux directory with the following permissions:
d-w-------
Can the owner of this directory do anything with it?
cd returns Permission denied
touch c/file likewise
Are there any situations where this directory would be useful?
Related
RHEL8.3 OS is being used on server, Yesterday i have accidently executed command chmod 644 /* from /usr/share/fonts directory after command execution i am not able to access server with ssh or on putty.
Admin is trying to connect to server with root user but he is getting error /bin/bash: Permission Denied.
Please suggest how to restored permissions or resolve issue.
Refer to here, 644 means you can't even execute the file, with or without root.
Permissions of 644 mean that the owner of the file has read and write access, while the group members and other users on the system only have read access.
Could you try sudo chmod 755 /* or without root chmod 755 /*?
Also, you may try this.
If nothing works, reinstalling your system will be the only choice left.
Trying to get ansible file/directory permissions to work.
In ansible I create a user:
user: name=testuser shell=/sbin/nologin uid=1234 comment="Test User"
Then I try to change ownership of a file directory:
file: path=/etc/myfile state=directory owner=testuser group=testuser mode=0644 recurse=yes
I also have tried setting a facl for a file:
acl:
name: /var/log/audit/audit.log
entity: filebeat
etype: user
permissions: rx
state: present
When observing the file permissions and the facl, they appear to be set correctly. However if I change the shell of my test user and login, I discover that I don't actually have the permissions that ansible presumably set. I keep getting a "Permission Denied" message.
If I understand what you mean, you get "Permission denied" when you try accessing to the directory content, e.g. running ls -l /etc/myfile .
This is the right *nix behaviour because you setted acces permission to mode=0644.
About directories, the execute bit allows the affected user to enter the directory, and access files and directories inside.
So, to allow your testuser going through the directory, set at least mode=0744.
To allow testuser group mode=0754 and to allow everybody mode=0755
I want to create files and directories in a directory outside my home directory (on a different physical drive as I'm running out of space on my main drive). However I'm getting files with different permissions when I create them in a directory outside home which causes permission denied errors when I later execute some commands on these files I created.
I would like to use the directory outside my home (which is on different drive) in the same way as my home directory. How to do it?
To be specific, I'm following this manual http://project-magpie.github.io/yocto/2014/09/26/building-a-yocto-image-for-the-a20-olinuxino-lime/ but when executing "source oe-init-build-env ../build/a20-lime" command I'm getting permission denied error when I work in a directory outside my home on different drive.
When I work in my home I get no permission denied errors.
I have a file(file) with permission 500. In Linux, I tried to copy (using cp) that file into a folder (a) whose permission is 600. Even though folder have write permission, I am getting " cannot stat `a/file': Permission denied error.
Could anyone explain why is it so?
Is it because directory does not have executable permission ?
Execute bit allows the affected user to enter the directory, and access files and directories inside.
Plse see http://www.hackinglinuxexposed.com/articles/20030424.html
https://unix.stackexchange.com/questions/21251/why-do-directories-need-the-executable-x-permission-to-be-opened for further info
I am using RStudio server (Version 0.98.994) on Ubuntu 12.04.
Our group works on a external share drive together and would like to open the same project.
When I open a project file created by other colleagues, I got an error with permission denied (Sorry I cannot show the error message as I already changed the permission manually).
After checking the file permission, I found the default permission is "-rw-r--r-x" for *.Rproj and .Rhistory, "drwxr-sr-x" for ".Rproj.user". So no write permission for group.
In the external share drive (no sure about system, should be Linux), the default permission is rw for group.
How could I change the default permission for *.Rproj, .Rhistory and .Rprojt.user?
Thanks for any advice. Please let me know if my question is not clear.
EDIT:
I created new file and folder in the external share drive from command line. The default permission is -rw-rw-r-- for file and drwxrwsr-x for folder, as I expected. It seems RStudio server created these new files with their own default permission.
Could I change the default permission of these files *.Rproj, .Rhistory and .Rprojt.user when RStudio server creates them? i.e. Add write permission to group.
The default permissions for Directories are 777 which is read/write/execute and for Files it is 666 which is read/write. But then every system has a umask value, which is normally 022.
So when you create a directory it will have permissions 777 but it will take away the umask value of 022 and leave you with your default permissions of 755 which is rwxr-xr-x
You can change the value of umask by simply entering the command
umask=055
This will set the umask value to 055 and whenever you create a new file/directory, 055 will be taken away from the permissions.
Again look at a newly created directory with permissions of 777 and the umask value is taken away so the directories permission is 722 which is rwx-w--w-
Again look at a new directory with permissions