Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CURL permission denied via browser, works on ssh

Yesterday I have changed my usergroup/user on my linux host for a group of files. Today I found out that CURL is rising a permission denied (only on browser access, works on SSH)

Couldn't send request: Failed to connect to <server_ip>: Permission denied

file is currently have 777 permissions. But I thinks it is related with user group/user.

ls -all result:

-rwxrwxrwx.  1 baknealdi psaserv    533 May 18 05:14 check.php

Listed users groups;

root:x:0:
psaserv:x:504:apache,psaftp,psaadm,nginx
psacln:x:505:

And I have read somewhere that selinux might be related with it.

sestatus result:

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 24
Policy from config file:        targeted

I can give any other information, but I really don't know what is related.

like image 616
Bartu Avatar asked May 18 '13 10:05

Bartu


People also ask

How do I fix SSH permissions denied?

If you want to use a password to access the SSH server, a solution for fixing the Permission denied error is to enable password login in the sshd_config file. In the file, find the PasswordAuthentication line and make sure it ends with yes . Find the ChallengeResponseAuthentication option and disable it by adding no .

How do I fix Permission denied in Linux terminal?

To fix the permission denied error in Linux, one needs to change the file permission of the script. Use the “chmod” (change mode) command for this purpose.

How do I get permission to denied Publickey?

This error comes up when using a wrong private key or no key at all when trying to connect via SSH. To resolve the problem, you should generate a new key pair and connect using that new set of keys.


1 Answers

Simply applying this line of code in the PHP configuration made it;

setsebool -P httpd_can_network_connect 1

which enabled http network connections.

like image 194
Bartu Avatar answered Oct 12 '22 23:10

Bartu