diff --git a/client/src/main.rs b/client/src/main.rs index 8e5cbed..d4b7dd7 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -992,16 +992,16 @@ fn main() { } fn run(opt: Opts) -> Result<(), Error> { - if unsafe { libc::getuid() } != 0 { - return Err("innernet must run as root.".into()); - } - let command = opt.command.unwrap_or(Command::Show { short: false, tree: false, interface: None, }); + if unsafe { libc::getuid() } != 0 && !matches!(command, Command::Completions { .. }) { + return Err("innernet must run as root.".into()); + } + match command { Command::Install { invite, diff --git a/server/src/main.rs b/server/src/main.rs index da43f4d..9966c32 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -227,7 +227,7 @@ async fn main() -> Result<(), Box> { pretty_env_logger::init(); let opt = Opt::from_args(); - if unsafe { libc::getuid() } != 0 { + if unsafe { libc::getuid() } != 0 && !matches!(opt.command, Command::Completions { .. }) { return Err("innernet-server must run as root.".into()); }