LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need to get command for folder permissions (https://www.linuxquestions.org/questions/linux-newbie-8/need-to-get-command-for-folder-permissions-491550/)

ajd344 10-11-2006 04:19 PM

Need to get command for folder permissions
 
Hey! I'm running Ubuntu. I have a folder in the /opt/ folder I need to make full-access. Can you give me a command that makes it full-access (read,write,etc.) INCLUDING subdirectories? I guess it would be for everyone (if possible), but if it has to be something it would be user 'andrew'.

Thanks!

acid_kewpie 10-11-2006 04:29 PM

chmod -R 777 /opt/whatever

really not likely to be a great solution to whatever problem you have though... you might want to explore your underlying requirements.

ajd344 10-11-2006 07:28 PM

Thanks, that worked! I want to make sure I'm doing this right. I'm running a webserver (xampp), and PHP was having troube, and exploring it from my windows pc to the server (samba), premissions would get messed up.

So, it making the directory full-access a good solution to this problem? I need full access to work on my site through samba.

Gracias!

timmeke 10-12-2006 05:52 AM

World writable permissions are typically not a good idea.
Set the permissions to "770" for starters. "2770" may be better even.
And give them an appropriate user/group as owner.
Samba will access the files as some user/group, so you'll only need to give "full" access to that user/group.

Make also sure that the user under which your webserver runs has read access to the files (for your website).

ajd344 10-12-2006 02:18 PM

OK, I understand this so far. I access smb through user 'andrew', which is also the user in which the server runs. Can you give me a command that will set 770 or 2770 (whats the difference, anyway?) for just andrew? Thanks!

timmeke 10-13-2006 02:03 AM

Read = 4, Write = 2 and Execute = 1.
7 = 4 + 2 + 1 = rwx (read-write-execute).
0 = no permission.
Permissions are usually given in 3 such digits: one for the user that owns the file/dir, one for the group and one for everyone else.
So, 770 simply means full access to user/group, no access at all for anyone else.
The 2 in front indicates the setGID permission bit. This bit sets the Group ID (the numerical representation of a group) whenever the directory is executed (ie when someone searches through the directory or adds/deletes a file).
This will have the effect that all newly created files will automatically be owned by the group that owns the directory itself. This in turn has some benefits relating to access for website admins.

Use "chown" to make the directory owned by "andrew". Then use "chmod" with permission 770, 2770 or even more strict (ie 750).

If you're not comfortable using the octal representation of permissions, you can use the character representations too. See man chmod for details.
Example:
chmod -R u+rwx some_dir
gives the user (owner) rwx permissions.


All times are GMT -5. The time now is 03:41 PM.