Socket permission denied linux

Kali linux socket: Permission denied, run ettercap failed #438

Comments

Neutrino3316 commented Dec 1, 2018 •

Device: [e.g. Pixel XL 2]
Android Version: 8.0.0
UserLAnd Version 1.0.2

Run UserLAnd
Click on Apps
Click on Kali
Then wait till it is installed
Next, I connect to this kali by ssh

ettercap can’t run

I install ettercap by this:

add try to run ettercap

and then get this error:

netdiscover can’t run

I install netdiscover by this:

add try to run netdiscover

and then get this error:

Am I missing something? Or does anyone have a good idea to solve this problem?

The text was updated successfully, but these errors were encountered:

EnderNightLord-ChromeBook commented Dec 5, 2018

you may need to use:

$ sudo su (to go into root mode) and then use your command
or
$ sudo (and your command)

Neutrino3316 commented Dec 8, 2018

$ sudo su (to go into root mode) and then use your command
or
$ sudo (and your command)

Still, it can’t work. I get the error Permission denied again.
Maybe that’s because my phone is no rooted?

EnderNightLord-ChromeBook commented Dec 8, 2018 •

no. the file system has access to itself so I don’t know.

Neutrino3316 commented Dec 8, 2018

no. the file system has access to itself so I don’t know.

I think maybe it’s because that we don’t have high privilege authorization to access and control the network device.

EnderNightLord-ChromeBook commented Dec 8, 2018

you might be right there.

EwanValentine commented Apr 2, 2019

Anyone find a solution for this?

EnderNightLord-ChromeBook commented Apr 2, 2019

Um not yet. It may be the program just can’t run in a chroot.

EwanValentine commented Apr 2, 2019

I’ve read it’s possibly missing ath10k drivers or something? I’m going to try a usb wifi dongle and see what happens

jawetzel1992 commented Apr 21, 2019

Same issue with my Samsung s9 plus, I’m thinking need external wifi card that’s compatible. Anyone else try one yet with same issues ?

antuspcm commented Jun 9, 2019 •

same on my s9 with ping. strace showed permission denied opening a socket with admin and raw capabilities. found a workaround in another thread so repost here for orthers. run su (even though you are allready root) and the new shell is initialised properly and then it works. looks like a kali bug, nothing to do with your hardware.

as root, in roots home dir, i ran:
echo «su» >> .bash_profile
to do this everytime the shell starts. now kali chroot is working as expected from the start.
note that you cant put su — in .bash_profile because that will run the profile again. just plain su will not.

Читайте также:  С and linux programming interface

T16bros commented Jul 7, 2019

i did sudo su
then sudo ettercad -G and it worked for me

k1941996 commented May 1, 2020

i dont think this is a permanent solution. Im running arp-scan —local then also erro arrives: my_lookupdev: Permission Denied

L96Github commented Jun 19, 2020

i dont think this is a permanent solution. Im running arp-scan —local then also erro arrives: my_lookupdev: Permission Denied

Yep same issue on Huawei P30 Pro. su sudo didn’t work in either arp-scan nor netdiscover

YeMinAung2004 commented Aug 19, 2021

i’m stucking on this i’m using Android kali linux but ettercap says this : ERROR : 13, Permission denied
[/build/ettercap-gsX8lN/ettercap-0.8.3.1/src/ec_capture.c:capture_getifs:114]

ccmni0: SIOCETHTOOL(ETHTOOL_GLINK) ioctl failed: Permission denied

Источник

PHP socket error Permission denied on Linux

I have installed php 5.4.13 on Linux 2.6.34.

I have make simple client/server page using socket but it did not work on it.

It give permission denied error

Below is my php code

Above code work fine on command prompt but it gives error Permission denied when page open from any browser.

Command of run php from terminal : /usr/local/rootfs/php5/bin/php /www/socket_client.php

3 Answers 3

Check your php.ini settings for the parameter «safe_mode«. It should be «Off«.

Another problem could be caused by «selinux» that is blocking your mod_php (apache process) from connecting via socket. In this case:

If you want to disable it completely:

Also, for debug reasons, disable any security module on apache/PHP. For example try to disable Suhosin if it’s running.

This issue seems to have nothing to do with PHP but with the permissions of the Apache web server (httpd).

I tried to fix the permission issue, but was not yet succesful.

If I disable the user switching in httpd.conf, my (Unix socket) connection works. However, this is only a quick development workaround is not the final solution, since the whole httpd runs as root this way.

I had a similar problem:

Warning: fsockopen(): unable to connect to udp://192.168.1.255:7 (Permission denied) in /var/www/html/udp.php on line 1

Fatal error: Uncaught Exception: Cannot open UDP socket: Permission denied in

php.ini if the server let’s you change this configuration:

Terminal check Firewall:

Broadcasting to 192.168.1.255 is not allowed, I changed it to the according IP address, i.e. 192.168.1.24

By default broadcasts are disabled for sockeds. The socket_set_option command enables broadcast messages.

The follwoing script on the official PHP site:

Источник

docker.sock permission denied

When I try to run simple docker commands like:

I get an error message:

Got permission denied . /var/run/docker.sock: connect: permission denied

When I check permissions with

I see this line:

So, I follow an advice from many forums and add local user to docker group:

But it does not help. I still get the very same error message. How can I fix it?

10 Answers 10

For those new to the shell, the command:

needs to have $USER defined in your shell. This is often there by default, but you may need to set the value to your login id in some shells.

Changing the groups of a user does not change existing logins, terminals, and shells that a user has open. To avoid performing a login again, you can simply run:

Читайте также:  Windows ярлык с url

to get access to that group in your current shell.

Once you have done this, the user effectively has root access on the server, so only do this for users that are trusted with unrestricted sudo access.

Reason: The error message means that the current user can’t access the docker engine, because the user hasn’t enough permissions to access the UNIX socket to communicate with the engine.

Quick Fix:

Run the command as root using sudo.

Change the permissions of /var/run/docker.sock for the current user.

Caution: Running sudo chmod 777 /var/run/docker.sock will solve your problem but it will open the docker socket for everyone which is a security vulnerability as pointed out by @AaylaSecura. Hence it shouldn’t be used, except for testing purposes on the local system.

Permanent Solution:

Add the current user to the docker group.

Note: You have to log out and log in again for the changes to take effect.

Refer to this blog to know more about managing Docker as a non-root user.

Make sure your $USER variable is set

logout

Upon login, restart the docker service

As mentioned earlier in the comment the changes won’t apply until your re-login. If you were doing a SSH and opening a new terminal, it would have worked in new terminal

But since you were using GUI and opening the new terminal the changes were not applied. That is the reason the error didn’t go away

So below command did do its job, its just a re-login was missed

As my user is and AD user, I have to add the AD user to the local group by manually editing /etc/group file. Unforrtunately the adduser commands do not seem to be nsswitch aware and do not recognize a user not locally defined when adding someone to a group.

Then reboot or refresh /etc/group. Now, you can use docker without sudo.

bash into container as root user docker exec -it —user root bash

create docker group if it’s not already created groupadd -g 999 docker

add user to docker group usermod -aG docker jenkins

change permissions chmod 777 /var/run/docker.sock

When I try to run simple docker commands like: $ docker ps -a

I get an error message: Got permission denied . /var/run/docker.sock: connect: permission denied .

TL;DR: There are two ways (the first one, also mentioned in the question itself, was extensively addressed by other answers, but comes with security concerns; so I’ll elaborate on this issue, and develop the second solution that can also be applicable for this fairly sensible use case).

Just to recall the context, the Docker daemon socket is owned by root:docker :

so with this default setup, one needs to prepend all docker CLI commands by sudo .

To avoid this, one can either:

add one’s user account ( $USER ) to the docker group − but that’s quite risky to do this on one’s personal workstation, as this would amount to provide all programs run by the user with root permissions without any sudo password prompt nor auditing.

one can otherwise prepend sudo automatically without typing sudo docker manually: to this aim, a solution consists in adding the following alias in the

/.bashrc (see e.g. this thread for details):

Then one can test this by opening a new terminal and typing:

Читайте также:  Виндовс не видит линукс при загрузке

Источник

what can cause a socket() «Permission denied» error?

Under Android 4, the following simple native C code line fails with an Permission denied error when not run as root :

I do have root access to the device, but want to run the process as non-privileged user.

Note that the error happens even before binding the socket.

I guess there is some security setting that needs to be tweaked? Anyone can tell me where to look?

The O/S is really Android in this case, but I guess the problem is really Linux-related (since Android is based on a Linux Kernel).

For those wondering: This is a custom program that runs in a full ( debootstrap ped) Debian Jessie installation running in an Android 4 environment.

Update

I’ve learned that the Android Kernel has a special CONFIG_ANDROID_PARANOID_NETWORK extension that allows network access only to users in AID_INET and AID_NET_RAW groups.

However, even after adding the user to these groups, socket() is still rejected (and ping appears to have the same problem, BTW).

I can’t tell if that CONFIG_ANDROID_PARANOID_NETWORK flag is set in this particular Kernel, as I don’t have access to the config file.

Update 2

I found out that both root and also my unprivileged user imp can in fact successfully call socket() — at least with the groups setup described above.

However, calling the same process as root and then switching to imp using the seteuid() system call prevents socket() from succeeding. Any ideas?

Источник

Mysql. Bind on unix socket: Permission denied

Can’t start mysql with:

Another mysql is not runnig:

Permissions on «/tmp» and «/var/lib/mysql» are 777/

UPD1:

UPD2: plugin.MYD, plugin.MYI and plugin.frm are exists in /var/lib/mysql/mysql/.

Nothing running on port 3306.

mysql.sock does not exist. I tried to create it myself, but after restart it was removed.

This problem appeared today when I tried to clone my site on a subdomain.

6 Answers 6

1) First make sure you delete the existing socket file using the rm command.

2) Kill all existing MySQL processes via the following command.

3) Very important: Make sure the permission for the MySQL database directory under /var/lib/ folder should be mysql:root

4) With the above information you should be able to start MySQL successfully and the socket file should be created successfully under the database directory.

Thanks to @Abhishek’s answer combined with mysqld output(Can’t use /var/run/mysqld/mysqld.sock) I managed to solve this with one command:

Then it starts properly:

Your problem can be caused by any condition that prevents the MySQL daemon from writing a socket file to the path /var/lib/mysql . The other answers, such as a read-only filesystem or incorrect directory ownership, address various reasons that MySQL may not be able to write to the socket.

Another possible reason is that /var/lib/mysql may have the incorrect SELinux context. You can diagnose this condition by checking for recent SELinux AVC denials after attempting to start the MySQL daemon:

ausearch -m avc —start recent

If SELinux is denying access to create the socket file, you will see an error message like this:

To resolve an SELinux denial, try to restore the default context of the directory (your distribution should set the correct context of mysqld_db_t when you installed MySQL or MariaDB):

restorecon -R -v -f /var/lib/mysql

If you have customized the contexts on your system, fixing the problem is beyond the scope of this post.

Источник

Оцените статью