From e1caca3e412fc8f4e9e619873ca405d0a736ff7f Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Fri, 1 Dec 2023 14:03:49 +0000 Subject: [PATCH] kata-ctl: Remove root requirement for "env" Remove the redundant `kata-ctl` `root` check when running the `env` command. This check duplicated the `GuestProtection` check, and that check is now no longer necessary anyway. Signed-off-by: James O. D. Hunt --- src/tools/kata-ctl/src/ops/env_ops.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/tools/kata-ctl/src/ops/env_ops.rs b/src/tools/kata-ctl/src/ops/env_ops.rs index 7c334372991e..109dce6a9b4e 100644 --- a/src/tools/kata-ctl/src/ops/env_ops.rs +++ b/src/tools/kata-ctl/src/ops/env_ops.rs @@ -13,7 +13,6 @@ use kata_sys_util::protection; use kata_types::config::TomlConfig; use anyhow::{anyhow, Context, Result}; -use nix::unistd::Uid; use serde::{Deserialize, Serialize}; use std::fs::File; use std::io::{self, Write}; @@ -473,10 +472,6 @@ pub fn get_env_info(toml_config: &TomlConfig) -> Result { } pub fn handle_env(env_args: EnvArgument) -> Result<()> { - if !Uid::effective().is_root() { - return Err(anyhow!("kata-ctl env command requires root privileges to get host information. Please run as root or use sudo")); - } - let mut file: Box = if let Some(path) = env_args.file { Box::new( File::create(path.as_str()).with_context(|| format!("Error creating file {}", path))?,