linuxnetwork-programmingresolvelinux-from-scratch

Permission denied when opening socket or using resolver


I've set up an LFS system and I must have missed a step somewhere. I can only resolve hostnames if I am root:

$ host 6thstreetradio.org
net.c:150: socket() failed: Permission denied
net.c:150: socket() failed: Permission denied
host: can't find either v4 or v6 networking
$ sudo host 6thstreetradio.org
Password: 
6thstreetradio.org has address 67.246.2.103
6thstreetradio.org mail is handled by 5 6thstreetradio.org.

!? Am I missing a permission somewhere in the proc filesystem? Something else? Google searches is turning up nothing, but I'm probably searching for the wrong thing. The code reference in net.c is failing on simple socket creation:

s = socket(domain, SOCK_STREAM, 0);

Any clues?


Solution

  • Did you set the flag "CONFIG_ANDROID_PARANOID_NETWORK"? You can check the details here : serverfault.com. If so, please try this:

    groupadd -g 3003 aid_inet
    usermod -G -a aid_inet $YOUR-USER
    

    Also please check the permission of binary files and the config files.