permission denied while copying eventhough necessary permission exist - linux

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

Related

Is execute permisson required in uploading file by scp?

I created a web application directory and app in the directory.
And, they have 776 permission and their group is apache:apache.
I'd like to allow others to upload modules by scp.
But,I want others not to execute programs.So,I don't give "x" others , but it doesn't work. They cant upload file and permisson denied.others group is "xxx".
I think if others have read and write permission , they can upload file. What is wrong?
In order to add files to a directory you need both write (+w) and execute (+x) permissions.
See this answer for how file permissions work in Linux:
https://unix.stackexchange.com/questions/21251/execute-vs-read-bit-how-do-directory-permissions-in-linux-work
The execute permission on a directory does not imply files in that directory are made executable.

What use is only write permission on a folder?

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?

Linux file permissions outside home

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.

how to change file permission to view image

For some reason when I SCP'd my files to my server an image did not get the same permission as other files that were uploaded. For this reason I am getting a 403 forbidden error.
My file permissions look like:
How can I set the permission of ima-1.png to have the same permissions as the other files above it?
run the command:
chmod 644 ima-1.png
That will provide the same permissions as the files above it.

Default group permission for RStudio Server

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

Resources