LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Permissions for directory in Linux (https://www.linuxquestions.org/questions/linux-newbie-8/permissions-for-directory-in-linux-4175426071/)

Abhishek47 09-07-2012 01:22 AM

Permissions for directory in Linux
 
Hi All,

I am a newbie to Linux and am trying to configure Apache 2 (Web Server), but I was not able to access the document root path with my user. After checking I was getting 403 forbidden error in my browser.
Also accidentally I changed the permissions of /etc after which I am facing INIT: cannot execute "/etc/X11/prefdm" message during start up.

Please help in this matter.

Thanks in advance.

Abhishek

acid_kewpie 09-07-2012 01:37 AM

what did you do *exactly* here? If you've *recursively* changed /etc then that can be a seriously horrible ting to recover from.

FYI, here are the permissions you'd usually have on the path to prefdm, but you'll most likely have this issue again and again...

[chris@thinkpad ~]$ ls -ld /etc/
drwxr-xr-x. 167 root root 12288 Sep 7 03:27 /etc/

[chris@thinkpad ~]$ ls -ld /etc/X11/
drwxr-xr-x. 6 root root 4096 Jan 24 2012 /etc/X11/

[chris@thinkpad ~]$ ls -l /etc/X11/
total 28
drwxr-xr-x. 2 root root 4096 May 18 2011 applnk
drwxr-xr-x. 2 root root 4096 Oct 3 2011 fontpath.d
-rwxr-xr-x 1 root root 1350 Oct 12 2011 prefdm
drwxr-xr-x. 5 root root 4096 Jan 24 2012 xinit
-rw-r--r-- 1 root root 547 Feb 8 2011 Xmodmap
drwxr-xr-x. 2 root root 4096 Sep 7 2011 xorg.conf.d
-rw-r--r-- 1 root root 493 Feb 8 2011 Xresources

chrism01 09-07-2012 03:37 AM

Can you tell us what distro+ver you have
Code:

cat /etc/*release*
If its an rpm based system eg RHEL/Centos etc, then this may help http://www.cyberciti.biz/tips/reset-...ermission.html

Abhishek47 09-10-2012 12:05 AM

Hi acid_kewpie,

Thank You for your help.
Below are the output:

ls -ld /etc/
drwxrwxrwx 107 root root 12288 Sep 10 10:07 /etc

ls -ld /etc/X11/
drwxrwxrwx 8 root root 4096 Jan 17 2011 /etc/X11/

ls -l /etc/X11
drwxrwxrwx 2 root root 4096 Aug 8 2008 applnk
drwxrwxrwx 2 root root 4096 Jan 17 2011 fs
-rwxrwxrwx 1 root root 947 Jul 13 2009 prefdm
drwxrwxrwx 2 root root 4096 Aug 8 2008 serverconfig
drwxrwxrwx 2 root root 4096 Aug 8 2008 sysconfig
drwxrwxrwx 2 root root 4096 Jan 17 2011 twm
drwxrwxrwx 5 root root 4096 Jan 17 2011 xinit
-rwxrwxrwx 1 root root 547 Nov 14 2007 Xmodmap
-rwxrwxrwx 1 root root 568 Jan 17 2011 xorg.conf
-rwxrwxrwx 1 root root 492 Nov 14 2007 Xresources

Hi Chris,

Thank You for your advise.Below is the output:
cat /etc/*release*

cat: /etc/lsb-release.d: Is a directory
Red Hat Enterprise Linux Server release 5.4 (Tikanga)

Thanks
Abhishek

John VV 09-10-2012 03:35 AM

Quote:

Also accidentally I changed the permissions of /etc
from the output you gave i am guessing you did this
--- only a guess ??? ---

Code:

su -
--- root password when asked ---
chmod -R 777 /etc

if so

do you have a FULL week 12 hours a day to fix

fixable but it WILL take a huge amount of time

reinstall is faster
30 Min. VS days and days

also RHEL5.4
you ARE paying red hat to KEEP it at this level ?? right ????
or did you never buy the required support contract 3 years ago ( 5.4 came out in Sep. 2009 )


as to Apache
it is like the game "GO" 3 weeks to learn and a lifetime to MASTER
there is a LOT to learn so your first stop is the documents
read them
http://httpd.apache.org/docs/
but rhel5 shipped with a OLD version
http://httpd.apache.org/docs/2.0/
you might need to build a current version from source
the current Apache 2.4 docs
http://httpd.apache.org/docs/2.4/

Mr. Alex 09-10-2012 03:59 AM

Quote:

Originally Posted by Abhishek47 (Post 4774742)
but I was not able to access the document root path with my user. After checking I was getting 403 forbidden error in my browser.

That's because apache uses it's own user "nodoby" (I believe that's how the user is called) who needs read and executable permissions all the way from first dir to last. If any dir in between lacks those, "nobody" will not be allowed to read webpage files.

acid_kewpie 09-10-2012 04:01 AM

the apache daemon is usually run my the httpd user on rhel, not nobody.

John VV 09-10-2012 04:11 AM

on red hat /var/www/http/ is owned by the apache user " httpd" all lowercase

chrism01 09-10-2012 07:55 PM

See my link in post #3; that should enable you to fix ownerships/perms


All times are GMT -5. The time now is 08:36 AM.