In my GO scenario, I have a function that might be called or not. This function has this statement:
bpfPath := fmt.Sprintf("/dev/bpf%d", i)
f, err = os.OpenFile(bpfPath, os.O_RDWR, 0666)
However, the file /dev/bpf0
could be opened only with sudo
.
Is it possible to ask a user for permission for sudo
only in case when I call to open this file, in runtime?