LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Permissions on Folders (https://www.linuxquestions.org/questions/linux-newbie-8/permissions-on-folders-4175412212/)

yankwizera 06-19-2012 04:34 AM

Permissions on Folders
 
Hello, I created a user "user1" and restricted the folder he can access using rbash but at the same time I want him to be able to upload files in that folder but that folder is also used by apache web server,
How can I do that without removing apache from the users? using chown or chmod?a practical example?

Thank you

pixellany 06-19-2012 06:19 AM

Permissions on a file or directory are organized in 3 categories: Owner, group, and other. In each category, there are three types of permission: read, write, and execute. For a file, execute is used only when the file is some kind of executable code--including scripts. For directories, the execute permission also controls whether one is allowed to create new files or directories.

If. for example, you want to grant privileges based on group membership, then it does not matter who else is in that group----all members of the group will have the same privileges (controlled by what is in the "group" field in the file or directory permissions.


The use of "rbash" appears act as a layer on top of these basics--I'm not familiar with the details, but Google finds lots of information

yankwizera 06-19-2012 10:12 AM

thank you very much Pixellany, as The person said: "it is something", am going to google it

chrism01 06-19-2012 07:15 PM

Quote:

For directories, the execute permission also controls whether one is allowed to create new files or directories.
I always believed the x perm on a dir is to enable you to traverse it using wildcards (search bit) ; without you can only list known filenames eg http://stackoverflow.com/questions/7...ions-reasoning if 'r' is set on in both cases.

I'm pretty sure 'w' is what allows you to create a file in that dir; its a write op on the dir file.

deep27ak 06-20-2012 02:02 AM

Quote:

Originally Posted by yankwizera (Post 4706789)
Hello, I created a user "user1" and restricted the folder he can access using rbash but at the same time I want him to be able to upload files in that folder but that folder is also used by apache web server,
How can I do that without removing apache from the users? using chown or chmod?a practical example?

Thank you

There are other ways as well to do the same

I think you should surf a bit about "setfacl"

yankwizera 06-20-2012 03:47 AM

Yeah, indeed I run into it and saw that it can do a lot, thank you so much

pixellany 06-20-2012 12:02 PM

Quote:

Originally Posted by chrism01 (Post 4707315)
I'm pretty sure 'w' is what allows you to create a file in that dir; its a write op on the dir file.

You need both x and w:
Code:

[mherring@herring-lap play]$ mkdir test
[mherring@herring-lap play]$ chmod test -x -w
[mherring@herring-lap play]$ ls -l|grep test
dr--r--r-- 2 mherring users 4096 Jun 20 12:59 test
[mherring@herring-lap play]$ touch test/newfile
touch: cannot touch ‘test/newfile’: Permission denied
[mherring@herring-lap play]$ chmod +w test
[mherring@herring-lap play]$ touch test/newfile
touch: cannot touch ‘test/newfile’: Permission denied
[mherring@herring-lap play]$ chmod +x test
[mherring@herring-lap play]$ touch test/newfile
[mherring@herring-lap play]$ ls test
newfile



All times are GMT -5. The time now is 12:15 PM.