Forbidden error after migration [SOLVED]
Forbidden error after migration
Server operating system + version
Ubuntu 20
Server virtualization technology used
KVM - Oracle
KeyHelp version + build number
Last version - 22.2
Additional information
This problem is happening to me with more KeyHelp installations.
The problem is with migration.
I compress all my files at cpanel or plesk server to zip, download zip and upload it to keyhelp via file manager.
After zip extraction, the domain will show a forbidden error.
I was google how to solve this situation and find this thread: viewtopic.php?t=1673
so I was run this command: chown keyhelp:www-data /home/keyhelp
Now my KeyHelp installation showing a forbidden error (not just web site where i extract .zip)
Forbidden
You don't have permission to access this resource.
Is it any way to fix this?
Regards
Ubuntu 20
Server virtualization technology used
KVM - Oracle
KeyHelp version + build number
Last version - 22.2
Additional information
This problem is happening to me with more KeyHelp installations.
The problem is with migration.
I compress all my files at cpanel or plesk server to zip, download zip and upload it to keyhelp via file manager.
After zip extraction, the domain will show a forbidden error.
I was google how to solve this situation and find this thread: viewtopic.php?t=1673
so I was run this command: chown keyhelp:www-data /home/keyhelp
Now my KeyHelp installation showing a forbidden error (not just web site where i extract .zip)
Forbidden
You don't have permission to access this resource.
Is it any way to fix this?
Regards
Re: Forbidden error after migration
Thank you for this hint.
I removed this answer from the topic.
This answer was misleading and not even part of the topic.
Gruß,
Tobi
-----------------------------
wewoco.de
Das Forum für Reseller, Digital-Agenturen, Bildschirmarbeiter und Mäuseschubser
Tobi
-----------------------------
wewoco.de
Das Forum für Reseller, Digital-Agenturen, Bildschirmarbeiter und Mäuseschubser
Re: Forbidden error after migration
What files / directories do you see inside /home/keyhelp ?
My installation has
/.config
/.lock
/keyhelp.backup
/www
Try
for repairing KeyHelp
My installation has
/.config
/.lock
/keyhelp.backup
/www
Try
Code: Select all
chown keyhelp:keyhelp /home/keyhelp/www
chown root:root /home/keyhelp/www/.well-known
Gruß,
Tobi
-----------------------------
wewoco.de
Das Forum für Reseller, Digital-Agenturen, Bildschirmarbeiter und Mäuseschubser
Tobi
-----------------------------
wewoco.de
Das Forum für Reseller, Digital-Agenturen, Bildschirmarbeiter und Mäuseschubser
Re: Forbidden error after migration
Later, after you have fixed your KeyHelp, here are some hints to fix the forbidden for the user account:
1) Check the file privileges here, do they belong to the correct username / usergroup:
2) Also check, if the domain is pointing to the directory you want.
3) Check if in this directory there is an index.html / index.htm /index.php etc. file.
---
-> So to speak, this is not a bug in KeyHelp and I will move this topic to the appropriate area of this forum.
1) Check the file privileges here, do they belong to the correct username / usergroup:
Code: Select all
/home/users/<USERNAME YOU TRY TO MIGRATE>/www/
3) Check if in this directory there is an index.html / index.htm /index.php etc. file.
---
-> So to speak, this is not a bug in KeyHelp and I will move this topic to the appropriate area of this forum.
Mit freundlichen Grüßen / Best regards
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Re: Forbidden error after migration
Hello Toby,
Thanks for your reply.
This is what I have done now:
KeyHelp still showing same error:
Forbidden
You don't have permission to access this resource.
Regards
Thanks for your reply.
This is what I have done now:
Code: Select all
root@ch1:~# cd /home/keyhelp
root@ch1:/home/keyhelp# ls
keyhelp.backup www
root@ch1:/home/keyhelp# chown keyhelp:keyhelp /home/keyhelp/www
root@ch1:/home/keyhelp# chown root:root /home/keyhelp/www/.well-known
root@ch1:/home/keyhelp# cd www
root@ch1:/home/keyhelp/www# ls
adminer keyhelp kh.webstats rainloop webmail
db-administration keyhelp.white_label phpmyadmin roundcube
root@ch1:/home/keyhelp/www#
Forbidden
You don't have permission to access this resource.
Regards
Re: Forbidden error after migration
Please provide the privileges with the command:
Of this directories:
Code: Select all
ls -la
Code: Select all
/home/keyhelp
/home/keyhelp/www
/home/keyhelp/www/keyhelp
Mit freundlichen Grüßen / Best regards
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Re: Forbidden error after migration
Alexander wrote: ↑Tue 29. Nov 2022, 09:59 Later, after you have fixed your KeyHelp, here are some hints to fix the forbidden for the user account:
1) Check the file privileges here, do they belong to the correct username / usergroup:
2) Also check, if the domain is pointing to the directory you want.Code: Select all
/home/keyhelp/users/<USERNAME YOU TRY TO MIGRATE>/www/
3) Check if in this directory there is an index.html / index.htm /index.php etc. file.
---
-> So to speak, this is not a bug in KeyHelp and I will move this topic to the appropriate area of this forum.
Thank you for your reply.
1) I can not find folder users inside keyhelp:
Code: Select all
root@ch1:/home/keyhelp# cd users
-bash: cd: users: No such file or directory
root@ch1:/home/keyhelp# ls
keyhelp.backup www
root@ch1:/home/keyhelp#
Code: Select all
root@ch1:/home/users/boka003/www#
Code: Select all
root@ch1:/home/users/boka003/www# ls -l /var
total 48
drwxr-xr-x 2 root root 4096 Nov 29 06:25 backups
drwxr-xr-x 19 root root 4096 Jan 11 2022 cache
drwxrwxrwt 2 root root 4096 Aug 12 06:25 crash
drwxr-xr-x 57 root root 4096 Jan 14 2022 lib
drwxrwsr-x 2 root staff 4096 Apr 15 2020 local
lrwxrwxrwx 1 root root 9 Dec 1 2021 lock -> /run/lock
drwxrwxr-x 14 root syslog 4096 Nov 29 06:24 log
drwxrwsrwx 3 vmail vmail 4096 Jan 14 2022 mail
drwxr-xr-x 2 root root 4096 Dec 1 2021 opt
lrwxrwxrwx 1 root root 4 Dec 1 2021 run -> /run
drwxr-xr-x 7 root root 4096 Dec 1 2021 snap
drwxr-xr-x 6 root root 4096 Jan 14 2022 spool
drwxrwxrwt 8 root root 4096 Nov 29 14:09 tmp
drwxr-xr-x 4 root root 4096 Jan 12 2022 www
root@ch1:/home/users/boka003/www#
2. Domain is in the right directory, if I create file index.html and write test inside, it will show "test" when I visit web site.
3. There was index.php
I had a similar problem when I was trying to migrate WordPress website from Plesk to KeyHelp.
When I created index.html via file manager, it was working fine.
Is there any command that can fix permissions for a single user?
Regards
Re: Forbidden error after migration
Hello, here is output:Alexander wrote: ↑Tue 29. Nov 2022, 14:11 Please provide the privileges with the command:
Of this directories:Code: Select all
ls -la
Code: Select all
/home/keyhelp /home/keyhelp/www /home/keyhelp/www/keyhelp
Code: Select all
root@ch1:/home/users/boka003/www# cd /home/keyhelp
root@ch1:/home/keyhelp# ls -la
total 32
drwxr-x--- 6 keyhelp keyhelp 4096 Oct 28 13:43 .
drwxr-xr-x 6 root root 4096 Jan 10 2022 ..
drwxr-xr-x 3 keyhelp keyhelp 4096 Apr 8 2022 .config
drwxrwxr-x 2 keyhelp keyhelp 4096 Nov 29 14:25 .lock
-rwxrwxr-x 1 keyhelp keyhelp 1024 Jan 12 2022 .rnd
-rw-r--r-- 1 keyhelp keyhelp 165 Oct 28 13:43 .wget-hsts
drwxrwxr-x 5 keyhelp keyhelp 4096 Mar 29 2022 keyhelp.backup
drwxrwxr-x 10 keyhelp keyhelp 4096 Sep 8 02:10 www
root@ch1:/home/keyhelp# cd /home/keyhelp/www
root@ch1:/home/keyhelp/www# ls -la
total 40
drwxrwxr-x 10 keyhelp keyhelp 4096 Sep 8 02:10 .
drwxr-x--- 6 keyhelp keyhelp 4096 Oct 28 13:43 ..
drwxrwxr-x 3 root root 4096 Jan 10 2022 .well-known
drwxrwxr-x 6 keyhelp keyhelp 4096 Jan 14 2022 adminer
lrwxrwxrwx 1 keyhelp keyhelp 10 Jan 14 2022 db-administration -> phpmyadmin
drwxr-xr-x 15 keyhelp keyhelp 4096 Sep 8 02:10 keyhelp
drwxrwxr-x 4 keyhelp keyhelp 4096 Jan 19 2022 keyhelp.white_label
drwxrwxr-x 8 keyhelp keyhelp 4096 Oct 29 00:00 kh.webstats
drwxr-xr-x 12 keyhelp keyhelp 4096 Nov 28 14:26 phpmyadmin
drwxr-xr-x 4 keyhelp keyhelp 4096 Sep 8 02:10 rainloop
drwxr-xr-x 13 keyhelp keyhelp 4096 Sep 8 02:10 roundcube
lrwxrwxrwx 1 keyhelp keyhelp 9 Jan 14 2022 webmail -> roundcube
root@ch1:/home/keyhelp/www# cd /home/keyhelp/www/keyhelp
root@ch1:/home/keyhelp/www/keyhelp# ls -la
total 140
drwxr-xr-x 15 keyhelp keyhelp 4096 Sep 8 02:10 .
drwxrwxr-x 10 keyhelp keyhelp 4096 Sep 8 02:10 ..
-rw-r--r-- 1 keyhelp keyhelp 3283 Jun 3 10:08 ajax.php
drwxr-xr-x 2 keyhelp keyhelp 4096 Apr 1 2022 api
drwxr-xr-x 2 keyhelp keyhelp 4096 Apr 7 2022 bin
drwxr-xr-x 3 keyhelp keyhelp 4096 Sep 7 17:07 cache
drwxr-xr-x 44 keyhelp keyhelp 4096 Sep 7 17:07 core
drwxr-xr-x 4 keyhelp keyhelp 4096 Oct 14 2021 cronjob
drwxr-xr-x 2 keyhelp keyhelp 4096 Oct 14 2021 functions
-rw-r--r-- 1 keyhelp keyhelp 69267 Aug 5 14:04 index.php
drwxr-xr-x 2 keyhelp keyhelp 4096 Oct 14 2021 init
drwxr-xr-x 5 keyhelp keyhelp 4096 Oct 14 2021 install
-rw------- 1 keyhelp keyhelp 369 Oct 14 2021 license.txt
drwxr-xr-x 20 keyhelp keyhelp 4096 Sep 7 17:07 locale
drwxr-xr-x 6 keyhelp keyhelp 4096 Oct 14 2021 misc
drwxr-xr-x 2 keyhelp keyhelp 4096 Aug 10 15:25 pages
-rw-r--r-- 1 keyhelp keyhelp 25 Oct 14 2021 robots.txt
drwxr-xr-x 3 keyhelp keyhelp 4096 Sep 7 17:07 theme
drwxr-xr-x 15 keyhelp keyhelp 4096 Sep 7 17:07 vendor
root@ch1:/home/keyhelp/www/keyhelp#
Re: Forbidden error after migration
To fix KeyHelp:
The permissions of the directory /home/keyhelp/ are not correct - do this:
---
To fix the user:
I had a typo in my path, so yes, "/home/users/..." is correct
All files within www/ must belong to the corresponding user.
By the way, you have postet the output of "ls -l /var" instead of the "ls -la /home/users/boka003/www"
The permissions of the directory /home/keyhelp/ are not correct - do this:
Code: Select all
chown keyhelp:www-data /home/keyhelp
---
To fix the user:
I had a typo in my path, so yes, "/home/users/..." is correct
You just have to make sure, to have the write file permissions. If they are off, you will encounter unexpected results (wrong diskspace calculation etc.). Always upload files from the context of the user, or perform a chown, if you did it as root, etc.I had a similar problem when I was trying to migrate WordPress website from Plesk to KeyHelp.
When I created index.html via file manager, it was working fine.
Is there any command that can fix permissions for a single user?
All files within www/ must belong to the corresponding user.
By the way, you have postet the output of "ls -l /var" instead of the "ls -la /home/users/boka003/www"
Mit freundlichen Grüßen / Best regards
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Re: Forbidden error after migration
Hi,
Thanks for your reply.
This command fixes my KeyHelp installation.
Here is a screenshot if permissions from the user file manager https://prnt.sc/IETUS4QwPl-j
It is still showing:
Forbidden
You don't have permission to access this resource.
Yes, files are uploaded as user via file manager, and then just extracted.
Can you please send me a chown command for fix user problem? I can run command everytime when I upload zip, it is fine to me.
Thanks for your reply.
Code: Select all
chown keyhelp:www-data /home/keyhelp
Here is a screenshot if permissions from the user file manager https://prnt.sc/IETUS4QwPl-j
It is still showing:
Forbidden
You don't have permission to access this resource.
By the way, you have postet the output of "ls -l /var" instead of the "ls -la /home/users/boka003/www"
Code: Select all
root@ch1:~# ls -la /home/users/boka003/www
total 698608
drwxr-x--- 15 boka003 www-data 4096 Nov 30 13:41 .
drwxr-xr-x 10 root root 4096 Oct 28 13:36 ..
-rw-r--r-- 1 boka003 boka003 213 Mar 20 2019 .editorconfig
-rwxr-xr-x 1 boka003 boka003 920 Nov 28 14:56 .env
-rw-r--r-- 1 boka003 boka003 739 Mar 20 2019 .env.example
-rw-r--r-- 1 boka003 boka003 111 Mar 20 2019 .gitattributes
-rw-r--r-- 1 boka003 boka003 151 Mar 20 2019 .gitignore
drwxr-xr-x 3 boka003 boka003 4096 Jul 30 2021 .well-known
-rw-r--r-- 1 boka003 boka003 4131 Mar 20 2019 README.md
drwxr-xr-x 2 boka003 boka003 4096 Oct 22 2021 Script
-rw-r--r-- 1 boka003 boka003 49748972 Sep 13 2021 Script.zip
drwxr-xr-x 12 boka003 boka003 4096 Sep 13 2021 app
-rw-r--r-- 1 boka003 boka003 1686 Mar 20 2019 artisan
-rwxr-xr-x 1 boka003 boka003 899 Sep 13 2021 backup
drwxr-xr-x 2 boka003 boka003 4096 Sep 13 2021 backup-env
-rw-r--r-- 1 boka003 boka003 213226884 Oct 28 13:42 backup.zip
drwxr-xr-x 3 boka003 boka003 4096 Sep 13 2021 bootstrap
-rw-r--r-- 1 boka003 boka003 1907 Sep 1 2021 composer.json
-rw-r--r-- 1 boka003 boka003 249633 Feb 24 2021 composer.lock
drwxr-xr-x 2 boka003 boka003 4096 Jan 22 2022 config
drwxr-xr-x 5 boka003 boka003 4096 Sep 13 2021 database
-rw-r--r-- 1 boka003 boka003 452021322 Nov 28 14:54 migracija.zip
-rw-r--r-- 1 boka003 boka003 928 Sep 2 2021 package.json
-rw-r--r-- 1 boka003 boka003 1156 Mar 20 2019 phpunit.xml
drwxr-x--- 8 boka003 boka003 4096 Sep 26 2021 public
drwxr-xr-x 6 boka003 boka003 4096 Feb 24 2021 resources
drwxr-xr-x 2 boka003 boka003 4096 Sep 13 2021 routes
-rw-r--r-- 1 boka003 boka003 563 Mar 20 2019 server.php
drwxr-xr-x 5 boka003 boka003 4096 Jul 30 2021 storage
drwxr-xr-x 4 boka003 boka003 4096 Sep 13 2021 tests
drwxr-xr-x 55 boka003 boka003 4096 Sep 13 2021 vendor
-rw-r--r-- 1 boka003 boka003 2022 Sep 5 2021 webpack.mix.js
root@ch1:~#
I think that all files have write permissions, as you can see at screenshot above.You just have to make sure, to have the write file permissions. If they are off, you will encounter unexpected results (wrong diskspace calculation etc.). Always upload files from the context of the user, or perform a chown, if you did it as root, etc.
All files within www/ must belong to the corresponding user.
Yes, files are uploaded as user via file manager, and then just extracted.
Can you please send me a chown command for fix user problem? I can run command everytime when I upload zip, it is fine to me.
Re: Forbidden error after migration
The privileges are fine. But your domain target is very likely not correct.
This looks like a Laravel application - you need to point your domain to the "public/" folder. These kind of applications always "launch" in the public folder. There also should be an index.php.
Additional security advice: Make sure, nobody can access the directory from your screenshot directly. There may be the 'system domain' like boka003.<KEYHELP-DOMAIN> which points to that directory. Nobody should have access to the .env file, which likely contains passwords to the database.
(hmm, maybe i should prevent access to hidden files in general?!)
This looks like a Laravel application - you need to point your domain to the "public/" folder. These kind of applications always "launch" in the public folder. There also should be an index.php.
Additional security advice: Make sure, nobody can access the directory from your screenshot directly. There may be the 'system domain' like boka003.<KEYHELP-DOMAIN> which points to that directory. Nobody should have access to the .env file, which likely contains passwords to the database.
(hmm, maybe i should prevent access to hidden files in general?!)
Mit freundlichen Grüßen / Best regards
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Re: Forbidden error after migration
Hello,
Here is image from cpanel file manager: https://prnt.sc/8L5rckodDKE7
Also I have edit link I .env file.
When I open link with /public/ this error show up
Forbidden
You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe
I had same problem with Wordpress migration.
If privileges are fine, is there anything other that can make problem (even with Wordpress) ?
Regards
Here is image from cpanel file manager: https://prnt.sc/8L5rckodDKE7
Also I have edit link I .env file.
When I open link with /public/ this error show up
Forbidden
You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe
I had same problem with Wordpress migration.
If privileges are fine, is there anything other that can make problem (even with Wordpress) ?
Regards
Re: Forbidden error after migration
Send me the login credentials, i will have a look...
Mit freundlichen Grüßen / Best regards
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Re: Forbidden error after migration [SOLVED]
The cause was, the public/ folder was set to privileges "rwx r-x ---" (750) instead of "rwx r-x r-x" (755).
Therfor the web server was not allowed to access this folder and showed a forbidden.
-> After changing the permissions it worked.
Therfor the web server was not allowed to access this folder and showed a forbidden.
-> After changing the permissions it worked.
Mit freundlichen Grüßen / Best regards
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************