标题(虽然很尴尬)已经说明了一切。首先一些背景:
我在 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 setsudo 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
Run Code Online (Sandbox Code Playgroud)
关于这里发生的事情有任何线索吗?
我在这里看到的一些可能的选项是: 1. Vultr 提供的自定义 ISO ...缺少一些东西 2. 一些应该sudo在 NixOS 中工作的根本不同的方式 3. 我缺少一些关于如何使用的非常基本的东西尼克斯(最有可能!)
一些细节:
[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
Run Code Online (Sandbox Code Playgroud)
编辑:最后一组有效的步骤:
security.sudo.enable = true;
Run Code Online (Sandbox Code Playgroud)
/etc/nixos/configuration.nix: # Allow members of the "wheel" group to sudo:
security.sudo.configFile = ''
%wheel ALL=(ALL) ALL
'';
Run Code Online (Sandbox Code Playgroud)
wheel:usermod -a -G wheel agam
Run Code Online (Sandbox Code Playgroud)
在 NixOS 上安装的方法sudo是添加configuration.nix:
security.sudo.enable = true;
Run Code Online (Sandbox Code Playgroud)
Nix 本身根本无法创建像 sudo 这样的 setuid 二进制文件。否则它就不可能是“安全且无策略的”——没有多用户支持。nix/ *工具nix-旨在执行安全存储操作,并且不允许特权提升。
为了支持 setuid 二进制文件sudo,NixOS 在 Nix 存储之外维护了一个 setuid 包装器目录,位于/run/wrappers. 这是唯一可能的,因为 NixOS 是使用 root 权限启动/切换/激活的。
| 归档时间: |
|
| 查看次数: |
3005 次 |
| 最近记录: |