标题(令人尴尬)说明了一切。首先介绍一些背景信息:
我正在Vultr上使用自定义ISO运行NixOS。
尝试时间范围:
which sudo
没有显示sudosudo
使用nix-env -i sudo
sudo ...
,我看sudo: /home/agam/.nix-profile/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo su
由于相同的原因而无法正常工作nix-env --uninstall sudo
)su
然后重复安装sudo ...
,我看到了sudo: /nix/var/nix/profiles/default/bin/sudo must be owned by uid 0 and have the setuid bit set
(与以前相同的错误,但路径不同)[root@nixos:/home/agam]# chmod 4755 /nix/var/nix/profiles/default/bin/sudo
chmod: changing permissions of '/nix/var/nix/profiles/default/bin/sudo': Read-only file system
关于这里发生的事情有什么线索吗?
我在这里看到的一些可能的选择是:1. Vultr提供的自定义ISO丢失了某些内容2.sudo
应该在NixOS中工作的一些根本不同的方式3.我缺少了一些非常基本的使用方法Nix(最有可能!)
一些细节:
[agam@nixos:~]$ nixos-version
18.09.1534.d45a0d7a4f5 (Jellyfish)
[agam@nixos:~]$ which sudo
/nix/var/nix/profiles/default/bin/sudo
[agam@nixos:~]$ nix-channel --list
nixos https://nixos.org/channels/nixos-18.09
编辑:有效的最后一组步骤:
security.sudo.enable = true;
/etc/nixos/configuration.nix
: # Allow members of the "wheel" group to sudo:
security.sudo.configFile = ''
%wheel ALL=(ALL) ALL
'';
wheel
:usermod -a -G wheel agam
sudo
在NixOS上安装的方法是添加到configuration.nix
:
security.sudo.enable = true;
Nix本身根本无法创建像sudo这样的setuid二进制文件。否则,它不能是“安全且无策略的”-没有多用户支持。该nix
/ nix-
*工具被设计来执行安全存储操作,而不是允许特权提升。
为了支持setuid二进制文件sudo
,NixOS在Nix存储区的外部维护了setuid包装器的目录/run/wrappers
。这仅是因为NixOS是使用root特权启动/切换/激活的。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句