Error 403

  • Hello,


    Here is my setup :


    Code
    1. Linux panel 3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:25:57 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux


    Ubuntu 12.04 64 bits
    I-MSCP 1.1.0-beta1


    Here are the steps I'm following to copy sites from an ISPCP 1.0.7 server.


    - Create user on the new server (4etplus.com)
    - Clean the folder

    Code
    1. rm -fr /var/www/virtual/4etplus.com/htdocs/*


    - Copy files via scp

    Code
    1. scp -r /var/www/virtual/4etplus.com/htdocs/* newserver:/var/www/virtual/4etplus.com/htdocs/


    - Launch a self made script to give the right ownership to the files ($1=4etplus.com) :

    Code
    1. export UTIL=$(ls -lad /var/www/virtual/$1/htdocs/ | awk {' print $3 '})chown -R $UTIL:$UTIL /var/www/virtual/$1/htdocs


    Then I try to access my site and got error 403


    In the logs I have


    Code
    1. [Fri Jul 27 18:26:29 2012] [crit] [client 195.46.235.xx] (13)Permission denied: /var/www/virtual/4etplus.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable


    but the file /var/www/virtual/4etplus.com/htdocs/.htaccess does not exist.
    I've tried to change the permission on the files, tried to create this .htaccess file... but nothing worked...


  • but the file /var/www/virtual/4etplus.com/htdocs/.htaccess does not exist.
    I've tried to change the permission on the files, tried to create this .htaccess file... but nothing worked...


    At first.. Your scp command wont copy any hidden files The "*" only copy not hidden files. If you want to scp hidden files to (only the hidden files in the first folder) you need to use a command like this

    Code
    1. scp -rp /var/www/virtual/4etplus.com/htdocs/. newserver:/var/www/virtual/4etplus.com/htdocs/


    If you create the .htaccess on your own and you get an 403, check the permissions and the owner of this file.
    Maybe you can post content of the .htaccess.

    Edited once, last by TheCry ().

  • At first.. Your scp command wont copy any hidden files The "*" only copy not hidden files. If you want to scp hidden files to (only the hidden files in the first folder) you need to use a command like this

    Code
    1. scp -rp /var/www/virtual/4etplus.com/htdocs/. newserver:/var/www/virtual/4etplus.com/htdocs/


    Nice to learn for the future...



    If you create the .htaccess on your own and you get an 403, check the permissions and the owner of this file.
    Maybe you can post content of the .htaccess.


    The problem is there is no .htaccess file, neither on the source server, neither on the new server :


    Code
    1. ┌─( root ) - ( 3.2.0-27-generic ) - ( /var/www/virtual/4etplus.com/htdocs )└─> ls -lhatotal 24Kdrwxr-x--- 3 vu2008 vu2008 4,0K juil. 27 18:16 .drwx--x--- 9 vu2008 www-data 4,0K juil. 27 18:05 ..-rw-r----- 1 vu2008 www-data 53 juil. 27 18:16 googlee2116e01f7abd362.htmldrwxr-x--- 2 vu2008 www-data 4,0K juil. 27 18:16 images-rw-r----- 1 vu2008 www-data 304 juil. 27 18:16 index.html-rw-r----- 1 vu2008 www-data 199 juil. 27 18:16 style.css


    for gOOvER : there is no php in my site just html... so the suexec.log does not give us interesting things...


    Code
    1. [2012-07-27 18:17:23]: uid: (1004/vu2007) gid: (1004/vu2007) cmd: php5-fcgid-starter[2012-07-27 18:17:35]: uid: (1001/vu2000) gid: (1001/vu2000) cmd: php5-fcgid-starter[2012-07-27 18:40:26]: uid: (1004/vu2007) gid: (1004/vu2007) cmd: php5-fcgid-starter[2012-07-27 18:46:11]: uid: (1004/vu2007) gid: (1004/vu2007) cmd: php5-fcgid-starter


    And 4etplus.com-error.log says always the same error...


    Code
    1. [Fri Jul 27 18:22:38 2012] [crit] [client 195.46.235.xx] (13)Permission denied: /var/www/virtual/4etplus.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable[Fri Jul 27 18:22:39 2012] [crit] [client 195.46.235.xx] (13)Permission denied: /var/www/virtual/4etplus.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable[Fri Jul 27 18:22:39 2012] [crit] [client 195.46.235.xx] (13)Permission denied: /var/www/virtual/4etplus.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable[Fri Jul 27 18:23:24 2012] [crit] [client 195.46.235.xx] (13)Permission denied: /var/www/virtual/4etplus.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable[Fri Jul 27 18:24:45 2012] [crit] [client 195.46.235.xx] (13)Permission denied: /var/www/virtual/4etplus.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable[Fri Jul 27 18:24:46 2012] [crit] [client 195.46.235.xx] (13)Permission denied: /var/www/virtual/4etplus.com/htdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable


    [hr]
    Something strange : I just solved it typing


    Code
    1. chown vu2008:www-data htdocs/


    But what's strange... is on another folder I have strange rights :


    Code
    1. ┌─( root ) - ( 3.2.0-27-generic ) - ( /var/www/virtual )
    2. └─> ls -lhad */htdocs
    3. drwxr-x--- 3 vu2008 vu2008 4,0K juil. 27 23:22 4etplus.com/htdocs
    4. drwxr-x--- 3 vu2006 www-data 4,0K juil. 24 11:26 cornouailles.com/htdocs
    5. drwxr-x--- 3 vu2004 www-data 4,0K juil. 13 12:50 letechnomag.com/htdocs
    6. drwxr-x--- 3 vu2011 www-data 4,0K juil. 27 18:10 reiki-libre.be/htdocs
    7. drwxr-x--- 3 vu2009 www-data 4,0K juil. 27 18:09 telsecours.com/htdocs
    8. drwxr-xr-x 6 vu2007 vu2007 4,0K juil. 25 22:03 ursil.lu/htdocs
    9. drwxr-x--- 3 vu2010 www-data 4,0K juil. 27 18:09 zen-lavie.be/htdocs


    So, is there a reference about the correct permissions to set ?
    Sometimes the group is vu20xxn some time the group is www-data

    Edited once, last by VirtualCed ().


  • Can you please post your self made script and how you call this script on the command line?


    My script, used on iscp, is easy :


    it's called perm.sh

    Code
    1. export UTIL=$(ls -lad /var/www/virtual/$1/htdocs/ | awk {' print $3 '})chown -R $UTIL:$UTIL /var/www/virtual/$1/htdocs


    I just called it by


    perm.sh 4etplus.com


    But the permissions tree seems different here...


    It should be, maybe

    Code
    1. export UTIL=$(ls -lad /var/www/virtual/$1/htdocs/ | awk {' print $3 '})
    2. chown -R $UTIL:www-data/var/www/virtual/$1/htdocs

    Edited once, last by VirtualCed ().


  • It should be, maybe

    Code
    1. export UTIL=$(ls -lad /var/www/virtual/$1/htdocs/ | awk {' print $3 '})chown -R $UTIL:www-data/var/www/virtual/$1/htdocs


    No... Then every file is recurvive owned by vu***:www-data


    You need to change it like this:

    Code
    1. chown -R $UTIL:www-data/var/www/virtual/$1/htdocs/*


    And i think the 403 is comming up because the file permissions are not correct

    Edited once, last by TheCry ().