Find the answer to your Linux question:
Results 1 to 5 of 5
hi! i need to set certain permissions of the webserver group on a folder. if i do an ls, i see only 1000 as user and group. i suppose that ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2004
    Posts
    35

    how to know webserver id


    hi!

    i need to set certain permissions of the webserver group on a folder. if i do an ls, i see only 1000 as user and group. i suppose that is the admin. how would i know the webserver user/group id and set its permissions and ownership to the folder?

    thank you!

    on mdk10.1

  2. #2
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    the user and group can be found from the
    Code:
    ls -al
    command.

    Output will look simething like this:

    [quote]
    sdousley@homer:/var/www/localhost/htdocs> ls -al
    total 274816
    drwxr-xr-x 12 sdousley users 4096 Oct 28 23:59 .
    drwxr-xr-x 5 root root 4096 Sep 20 01:07 ..
    drwxr-xr-x 11 sdousley users 4096 Oct 12 19:14 blog
    -rw-r--r-- 1 sdousley users 899 Jul 9 17:21 form2.php
    drwxr-xr-x 2 sdousley users 4096 Jul 9 16:21 forms
    -rw-r--r-- 1 sdousley users 364804 Oct 28 23:55 homepage.sql
    drwxr-xr-x 2 sdousley users 4096 Oct 18 22:29 images
    -rw-r--r-- 1 sdousley users 475045 Oct 28 23:59 images.tar.gz
    drwxr-xr-x 2 sdousley users 4096 Oct 18 19:09 includes
    -rw-r--r-- 1 root root 1443 Sep 20 00:58 index.html
    -rw-r--r-- 1 sdousley users 349 Oct 14 21:17 index.php
    -rw-r--r-- 1 sdousley users 349 Oct 28 23:54 index2.php
    -rw-r--r-- 1 sdousley users 15 Jun 13 21:05 info.php
    drwxr-xr-x 4 sdousley users 4096 Oct 29 00:02 mysql
    drwxr-xr-x 9 root root 4096 Aug 23 12:17 mythweb
    -rw-r--r-- 1 sdousley users 7258 Jun 21 14:25 neil.html
    drwxr-xr-x 2 sdousley users 4096 Aug 22 11:32 odbc
    drwxr-xr-x 7 sdousley users 4096 Jun 13 22:18 phpmyadmin
    drwxr-xr-x 5 sdousley 1000 4096 Aug 22 23:02 phpsysinfo
    -rw-r--r-- 1 sdousley users 1456 Oct 18 19:02 projects.php
    -rw-r--r-- 1 sdousley users 0 Oct 13 21:43 projects2.php
    -rw-r--r-- 1 sdousley users 964 Oct 18 17:56 rss_feeds.php
    drwxrwxr-x 3 sdousley users 4096 Jul 4 16:46 sms
    -rw-r--r-- 1 sdousley users 279680102 Sep 1 12:42 tarball.tar.gz
    -rw-r--r-- 1 sdousley users 502856 Oct 10 19:30 title
    -rw-r--r-- 1 sdousley users 560 Oct 22 15:40 webcam.php
    sdousley@homer:/var/www/localhost/htdocs>
    [/code]

    There you can see that the folder "." (/var/www/htdocs) is owned by sdousley and the group users. also, that the owner user has rwx permissions where the users group has r-x as does the other users.

    If u wanna change the owner, you use the
    Code:
    chown
    command. say you wanted to own a file to the user "wwwrun" and group "www" you would run:
    Code:
    chown wwwrun&#58;www <file>
    Or if you wanted to own the entire webroot, use the -R (recursive) flag like this:
    Code:
    chown wwwrun&#58;www . -R
    Note the "." in there.

    To change the permissions, use the
    Code:
    chmod
    commandessentually the same as chown, but instead of user:group put the permissions you want. (eg 664 for rw-w--r--)

    Anything u dont understand, let me know, i'll try and expand on this explanation
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  3. #3
    Just Joined!
    Join Date
    Apr 2004
    Posts
    35
    hi!

    how would you know the user id of the webserver? apache in my case.


    thank you!

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    Code:
    cat /etc/passwd | grep apache
    In my example:

    apache:81:81:apache:/home/httpd:/bin/false
    the userid is 81
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  6. #5
    Just Joined!
    Join Date
    Apr 2004
    Posts
    35
    great! thank you!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •