Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operation not permitted #8

Closed
fenimore opened this issue Oct 4, 2016 · 2 comments
Closed

Operation not permitted #8

fenimore opened this issue Oct 4, 2016 · 2 comments

Comments

@fenimore
Copy link

fenimore commented Oct 4, 2016

Hi, I'm trying to use this library for sending some ARP requests, and I get an

operation not permitted

error when I try to create a client. I'm getting the interfacing, passing it's pointer to the NewClient method. like so:

ifaces, _ := net.Interfaces()
// The third for me is the relevant one.
client, err := arp.NewClient(&ifaces[2])
if err != nil {
    fmt.Println(err)
}

target := net.ParseIP("10.0.18.70")
err = client.Request(target)
if err != nil {
    fmt.Println(err)
}

So I then get a nil error when I call client.Request, because the original client is not permitted. Is this the correct way to proceed? Should I be using sudo? When I do that it complains that the GOPATH isn't set, and things get tricky.

@mdlayher
Copy link
Owner

mdlayher commented Oct 4, 2016

Yep, raw sockets require root permissions, or the CAP_NET_RAW capability (see man 7 capabilities).

It sounds like you're trying to use go run instead of go build? go build the binary as your user and then use sudo or set the capability on it to run it.

@fenimore
Copy link
Author

fenimore commented Oct 5, 2016

Thanks! This is it, now I'm getting a no IPv4 address available for interface, but atleast I'm accessing it :), I can take it from here.

Just to be clear, the problem went away when building the binary and running it as sudo.

@fenimore fenimore closed this as completed Oct 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants