# Re: Command to set folder\\\\file permitions

**URL:** <https://forums.suse.com/t/re-command-to-set-folder-file-permitions/21784>\
**Category:** SLES Configure-Administer\
**Created:** [August 31, 2011, 11:36am UTC](https://forums.suse.com/t/re-command-to-set-folder-file-permitions/21784 "2011-08-31T11:36:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![System1](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@System1](https://forums.suse.com/u/System1)\
**Post date:** [August 31, 2011, 11:36am UTC](https://forums.suse.com/t/re-command-to-set-folder-file-permitions/21784/1 "2011-08-31T11:36:02Z")

</div>

Hi

1. If the user wwwrun has read-rights on this folder, then the  
apache2-webserver serves this pages correctly outside. If you need to  
provide CGI-scripts, then you must add the executable-right to the  
wwwrun-user (or group www).
2. One way is  
Code:

* * *

## chown -R wwwrun:www /srv/www/htdocs/\*

## to set the correct ownership and Code:

## chmod -R 750 /srv/www/htdocs/\*

to set the proper rights.  
3) It depends, with which user these files are being created. One way  
could be to set the umask-flag for this user or the setgid-right on the  
directory.

Regards,  
Tom

## – amo\_vzug

amo\_vzug’s Profile: [http://forums.novell.com/member.php?userid=25342](http://forums.novell.com/member.php?userid=25342)  
View this thread: [http://forums.novell.com/showthread.php?t=443903](http://forums.novell.com/showthread.php?t=443903)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/5/5012ba89e3ffb5220dac47d5ea0ba032e2fe1cb6.png) [@system](https://forums.suse.com/u/system)\
**Post date:** [August 31, 2011, 11:56am UTC](https://forums.suse.com/t/re-command-to-set-folder-file-permitions/21784/2 "2011-08-31T11:56:02Z")

</div>

Thank you!

What will be the influence of the “h” switch in the “chown -hR  
wwwrun:www /srv/www/htdocs/\*” command?

What is the command to set the setgid-right on the directory.

TIA

Nanu

## – nanu

nanu’s Profile: [http://forums.novell.com/member.php?userid=39251](http://forums.novell.com/member.php?userid=39251)  
View this thread: [http://forums.novell.com/showthread.php?t=443903](http://forums.novell.com/showthread.php?t=443903)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/5/5012ba89e3ffb5220dac47d5ea0ba032e2fe1cb6.png) [@system](https://forums.suse.com/u/system)\
**Post date:** [August 31, 2011, 12:16pm UTC](https://forums.suse.com/t/re-command-to-set-folder-file-permitions/21784/3 "2011-08-31T12:16:02Z")

</div>

The “h”-switch changes only the the owner of the symlink itself (it  
touches not the ownership of the target-file).

## For the setgid-attribut, you need first to change the correct group. For instance: Code:

## chgrp www /srv/www/htdocs/

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/5/5012ba89e3ffb5220dac47d5ea0ba032e2fe1cb6.png) [@system](https://forums.suse.com/u/system)\
**Post date:** [September 1, 2011, 10:26am UTC](https://forums.suse.com/t/re-command-to-set-folder-file-permitions/21784/4 "2011-09-01T10:26:02Z")

</div>

Thanks,

amo\_vzug;2133193 Wrote:[color=blue]

> The “h”-switch changes only the the owner of the symlink itself (it  
> touches not the ownership of the target-file).
> 
> For the setgid-attribut, you need first to change the correct group.  
> For instance: \>[/color]  
> Code:  
> --------------------[color=blue][color=green]
> 
> > chgrp www /srv/www/htdocs/[/color][/color]  
> > --------------------[color=blue][color=green]  
> > .[/color]  
> > Then you need to modify the rights like this:[color=green]  
> > [/color][/color]  
> > Code:  
> > --------------------[color=blue][color=green]  
> > chmod 2770 /srv/www/htdocs/[/color][/color]  
> > --------------------[color=blue][color=green]  
> > [/color]  
> > /QUOTE]
> 
> Is the “2770” in the above code correct?
> 
> TIA
> 
> Nanu[/color]

## – nanu

nanu’s Profile: [http://forums.novell.com/member.php?userid=39251](http://forums.novell.com/member.php?userid=39251)  
View this thread: [http://forums.novell.com/showthread.php?t=443903](http://forums.novell.com/showthread.php?t=443903)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/5/5012ba89e3ffb5220dac47d5ea0ba032e2fe1cb6.png) [@system](https://forums.suse.com/u/system)\
**Post date:** [September 1, 2011, 2:16pm UTC](https://forums.suse.com/t/re-command-to-set-folder-file-permitions/21784/5 "2011-09-01T14:16:02Z")

</div>

It depends on, what you’re trying. All newly created directories below  
htdocs inherits the group, which you set on the htdocs-directory.

The commands

## Code:

chgrp www /srv/www/htdocs/  
chmod 2770 /srv/www/htdocs/

* * *

are setting the htdocs-directory to

## Code:

drwxrws— 2 root www 4.0K Sep 1 13:05 htdocs/

* * *

Regards  
Tom

## – amo\_vzug

amo\_vzug’s Profile: [http://forums.novell.com/member.php?userid=25342](http://forums.novell.com/member.php?userid=25342)  
View this thread: [http://forums.novell.com/showthread.php?t=443903](http://forums.novell.com/showthread.php?t=443903)
