标题(尽管是令人难堪的)说明了一切。一些背景首先:
我正在使用Vultr上的自定义ISO运行NixOS。
尝试的时间框架:
which sudo显示没有sudosudo安装nix-env -i sudosudo ...时,我看到了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这里发生了什么有什么线索吗?
我在这里看到的一些可能的选择是: 1. Vultr提供的自定义ISO是.缺少一些东西。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中添加sudoers部分 # Allow members of the "wheel" group to sudo:
security.sudo.configFile = ''
%wheel ALL=(ALL) ALL
'';wheelusermod -a -G wheel agam发布于 2019-03-16 00:32:50
在sudo上安装NixOS的方法是向configuration.nix中添加
security.sudo.enable = true;Nix本身根本无法创建像sudo这样的setuid二进制文件。否则,它不可能是“安全和政策自由”-没有多用户支持。nix/nix-*工具旨在执行安全的存储操作,并且不允许特权的提升。
为了支持像sudo这样的setuid二进制文件,NixOS在/run/wrappers存储之外维护一个setuid目录。这是可能的,因为NixOS是以根权限启动/切换/激活的。
https://stackoverflow.com/questions/55191125
复制相似问题