I am getting a permissions error when running cargo run
on certain programs. For example a "hello world" program runs with no issues but something like the following gives me a permissions error:
#![allow(unused_variables)]
use std::net::{TcpListener, TcpStream};
fn handle_client(stream: TcpStream) {
// do something
}
fn main() -> std::io::Result<()> {
let listener = TcpListener::bind("127.0.0.1:80")?;
for stream in listener.incoming() {
handle_client(stream?);
}
Ok(())
}
Error: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
Is this a Linux issue or should I be looking at permissions in my home folder for .cargo folder or something similar? This is the first time seeing this error.
Again, running cargo run
on something like this
fn main() {
println!("Hello, world!");
}
doesn't give me the error.
I am running Ubuntu 21.10