In NixOS, how to add a user to the sudoers file?How to add a user to sudoers file?How do I make a self-signed...
Am I required to correct my opponent's assumptions about my morph creatures?
What was Captain Marvel supposed to do once she reached her destination?
Why does the U.S. military maintain their own weather satellites?
What's the origin of the concept of alternate dimensions/realities?
Calculate Landau's function
Understanding data transmission rates over copper wire
Why don't 3D printer heads use ceramic inner walls?
Why do presidential pardons exist in a country having a clear separation of powers?
Can I lend a small amount of my own money to a bank at the federal funds rate?
Why haven't the British protested Brexit as ardently like Hong Kongers protest?
Where should I draw the line on follow up questions from previous employer
Is it good practice to speed up and slow down where not written in a song?
Who declared the Last Alliance to be the "last" and why?
Break down the phrase "shitsurei shinakereba naranaindesu"
Was a six-engine 747 ever seriously considered by Boeing?
German equivalent to "going down the rabbit hole"
Can authors email you PDFs of their textbook for free?
What caused the end of cybernetic implants?
Do universities maintain secret textbooks?
Which is the correct version of Mussorgsky's Pictures at an Exhibition?
Why are JWST optics not enclosed like HST?
Cheap oscilloscope showing 16 MHz square wave
What's the difference between a variable and a memory location?
Eliminate key lookup in execution plan
In NixOS, how to add a user to the sudoers file?
How to add a user to sudoers file?How do I make a self-signed certificate persist in nixos?How to unlock GNOME keyring automatically in NixOS?How do I configure postgres's authorization settings in nixos?how to set custom xkb_keymap in nixosCan I add package libasound2 to the NixOS repository?The setting of sudoers file is not reflectedHow to add a file to /etc in NixOS?How to boot to single user mode in nixosAccess forbidden on Apache webserver on NixOS
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I installed and am trying to get started with NixOS, and am trying to add my user to the sudoers file.
So that I'm not running all my commands as root I created a user following Chapter 7. User Management of the NixOS manual. That is, I ran
# useradd -m matthew
# su - matthew -c "true"
# passwd matthew
Enter new UNIX password: ***
Retype new UNIX password: ***
And also I added
users.extraUsers.matthew = {
isNormalUser = true;
home = "/home/matthew";
extragroups = [ "wheel" "networkmanager" ];
}
to /etc/nixos/configuration.nix
. But still I am not able to run sudo
as matthew
.
For example, when I try to open sudo's man page with sudo, I get the matthew is not in the sudoers file
error.
$ sudo man sudo
[sudo] password for matthew:
matthew is not in the sudoers file. This incident will be reported.
Then I tried following advice on how to add a user to the sudoers file in other distributions, namely editing with $ visudo
. But when I run that, nixos tells me not to edit that file. That is, running
$ visudo
opens /etc/sudoers.tmp
with first line reading
# Don't edit this file. Set the NixOS option ‘security.sudo.configFile’ instead.
How do I set the NixOS option ‘security.sudo.configFile’?
nixos
add a comment |
I installed and am trying to get started with NixOS, and am trying to add my user to the sudoers file.
So that I'm not running all my commands as root I created a user following Chapter 7. User Management of the NixOS manual. That is, I ran
# useradd -m matthew
# su - matthew -c "true"
# passwd matthew
Enter new UNIX password: ***
Retype new UNIX password: ***
And also I added
users.extraUsers.matthew = {
isNormalUser = true;
home = "/home/matthew";
extragroups = [ "wheel" "networkmanager" ];
}
to /etc/nixos/configuration.nix
. But still I am not able to run sudo
as matthew
.
For example, when I try to open sudo's man page with sudo, I get the matthew is not in the sudoers file
error.
$ sudo man sudo
[sudo] password for matthew:
matthew is not in the sudoers file. This incident will be reported.
Then I tried following advice on how to add a user to the sudoers file in other distributions, namely editing with $ visudo
. But when I run that, nixos tells me not to edit that file. That is, running
$ visudo
opens /etc/sudoers.tmp
with first line reading
# Don't edit this file. Set the NixOS option ‘security.sudo.configFile’ instead.
How do I set the NixOS option ‘security.sudo.configFile’?
nixos
Breadcrumb: nixos.org/nixos/manual/#sec-user-management
– Jeff Schaller♦
Jul 9 '17 at 23:33
@JeffSchaller thanks for the comment; I've tried following the instructions on that page. That is, I added the 'users.extraUsers.matthew' block to my '/etc/nixos/configuration.nix' and also ran 'useradd -m matthew' and 'su - alice -c "true"', and set password and all. Still getting the 'not in sudoers file' error.
– mherzl
Jul 10 '17 at 0:52
It's odd that this doesn't work. I happen to be working with a fresh NixOS install today, and adding"wheel"
toextraGroups
worked just fine. Note that it'sextraGroups
and notextragroups
.
– shadowtalker
Sep 6 '18 at 15:09
add a comment |
I installed and am trying to get started with NixOS, and am trying to add my user to the sudoers file.
So that I'm not running all my commands as root I created a user following Chapter 7. User Management of the NixOS manual. That is, I ran
# useradd -m matthew
# su - matthew -c "true"
# passwd matthew
Enter new UNIX password: ***
Retype new UNIX password: ***
And also I added
users.extraUsers.matthew = {
isNormalUser = true;
home = "/home/matthew";
extragroups = [ "wheel" "networkmanager" ];
}
to /etc/nixos/configuration.nix
. But still I am not able to run sudo
as matthew
.
For example, when I try to open sudo's man page with sudo, I get the matthew is not in the sudoers file
error.
$ sudo man sudo
[sudo] password for matthew:
matthew is not in the sudoers file. This incident will be reported.
Then I tried following advice on how to add a user to the sudoers file in other distributions, namely editing with $ visudo
. But when I run that, nixos tells me not to edit that file. That is, running
$ visudo
opens /etc/sudoers.tmp
with first line reading
# Don't edit this file. Set the NixOS option ‘security.sudo.configFile’ instead.
How do I set the NixOS option ‘security.sudo.configFile’?
nixos
I installed and am trying to get started with NixOS, and am trying to add my user to the sudoers file.
So that I'm not running all my commands as root I created a user following Chapter 7. User Management of the NixOS manual. That is, I ran
# useradd -m matthew
# su - matthew -c "true"
# passwd matthew
Enter new UNIX password: ***
Retype new UNIX password: ***
And also I added
users.extraUsers.matthew = {
isNormalUser = true;
home = "/home/matthew";
extragroups = [ "wheel" "networkmanager" ];
}
to /etc/nixos/configuration.nix
. But still I am not able to run sudo
as matthew
.
For example, when I try to open sudo's man page with sudo, I get the matthew is not in the sudoers file
error.
$ sudo man sudo
[sudo] password for matthew:
matthew is not in the sudoers file. This incident will be reported.
Then I tried following advice on how to add a user to the sudoers file in other distributions, namely editing with $ visudo
. But when I run that, nixos tells me not to edit that file. That is, running
$ visudo
opens /etc/sudoers.tmp
with first line reading
# Don't edit this file. Set the NixOS option ‘security.sudo.configFile’ instead.
How do I set the NixOS option ‘security.sudo.configFile’?
nixos
nixos
edited Jul 10 '17 at 0:31
mherzl
asked Jul 9 '17 at 21:29
mherzlmherzl
5325 silver badges20 bronze badges
5325 silver badges20 bronze badges
Breadcrumb: nixos.org/nixos/manual/#sec-user-management
– Jeff Schaller♦
Jul 9 '17 at 23:33
@JeffSchaller thanks for the comment; I've tried following the instructions on that page. That is, I added the 'users.extraUsers.matthew' block to my '/etc/nixos/configuration.nix' and also ran 'useradd -m matthew' and 'su - alice -c "true"', and set password and all. Still getting the 'not in sudoers file' error.
– mherzl
Jul 10 '17 at 0:52
It's odd that this doesn't work. I happen to be working with a fresh NixOS install today, and adding"wheel"
toextraGroups
worked just fine. Note that it'sextraGroups
and notextragroups
.
– shadowtalker
Sep 6 '18 at 15:09
add a comment |
Breadcrumb: nixos.org/nixos/manual/#sec-user-management
– Jeff Schaller♦
Jul 9 '17 at 23:33
@JeffSchaller thanks for the comment; I've tried following the instructions on that page. That is, I added the 'users.extraUsers.matthew' block to my '/etc/nixos/configuration.nix' and also ran 'useradd -m matthew' and 'su - alice -c "true"', and set password and all. Still getting the 'not in sudoers file' error.
– mherzl
Jul 10 '17 at 0:52
It's odd that this doesn't work. I happen to be working with a fresh NixOS install today, and adding"wheel"
toextraGroups
worked just fine. Note that it'sextraGroups
and notextragroups
.
– shadowtalker
Sep 6 '18 at 15:09
Breadcrumb: nixos.org/nixos/manual/#sec-user-management
– Jeff Schaller♦
Jul 9 '17 at 23:33
Breadcrumb: nixos.org/nixos/manual/#sec-user-management
– Jeff Schaller♦
Jul 9 '17 at 23:33
@JeffSchaller thanks for the comment; I've tried following the instructions on that page. That is, I added the 'users.extraUsers.matthew' block to my '/etc/nixos/configuration.nix' and also ran 'useradd -m matthew' and 'su - alice -c "true"', and set password and all. Still getting the 'not in sudoers file' error.
– mherzl
Jul 10 '17 at 0:52
@JeffSchaller thanks for the comment; I've tried following the instructions on that page. That is, I added the 'users.extraUsers.matthew' block to my '/etc/nixos/configuration.nix' and also ran 'useradd -m matthew' and 'su - alice -c "true"', and set password and all. Still getting the 'not in sudoers file' error.
– mherzl
Jul 10 '17 at 0:52
It's odd that this doesn't work. I happen to be working with a fresh NixOS install today, and adding
"wheel"
to extraGroups
worked just fine. Note that it's extraGroups
and not extragroups
.– shadowtalker
Sep 6 '18 at 15:09
It's odd that this doesn't work. I happen to be working with a fresh NixOS install today, and adding
"wheel"
to extraGroups
worked just fine. Note that it's extraGroups
and not extragroups
.– shadowtalker
Sep 6 '18 at 15:09
add a comment |
3 Answers
3
active
oldest
votes
Firstly, adding the user with useradd
and editing users.extraUsers is redundant. I've never bothered with useradd
on NixOS.
As for the sudo configuration, what you do is set the attribute to a string containing what you'd normally put into sudoers.
...
security.sudo.configFile = ''
Sudoers config goes here
''
...
Thank you. I added "security.sudo.configFile = ''%wheel ALL=(ALL) ALL''" to /etc/nixos/configuration.nix and that did not work, but then I ran the command "$ usermod -a -G matthew wheel" and that did work.
– mherzl
Jul 10 '17 at 4:06
add a comment |
My guess is that in your case, the problem comes from the fact that you created the same user both imperatively (with useradd
) and declaratively (in configuration.nix
).
First of all, make sure that you run nixos-rebuild switch
after each change to /etc/nixos/configuration.nix
. Second, if that is not enough, it is probably that the options that you passed declaratively cannot be used given that the user was already created. In which case, removing the user first and running nixos-rebuild switch
then should solve the issue.
Might be needed to log out/in or at least open a new login shell too? In my experience that's often needed for changes that involve group changes.
– olejorgenb
Jul 10 '17 at 14:11
Indeed, that's probably the case. On a fast laptop, I would even consider doingnixos-rebuild boot
followed byreboot
.
– Zimm i48
Jul 10 '17 at 14:16
Thank you @Zimmi48. I was rebooting after each change to /etc/nixos/configuration.nix, but running 'nixos-rebuild switch' is much faster. And also, from the output I was able to identify a syntax error in my .../configuration.nix which seemed to be causing my user to not be added to the wheel group.
– mherzl
Jul 10 '17 at 17:09
Note that rebooting alone doesn't do any good. It needs to be preceded bynixos-rebuild boot
ornixos-rebuild switch
– Zimm i48
Jul 10 '17 at 17:11
add a comment |
Adding a user to the wheel
group should be sufficient to gain sudo privileges.
After you've added a user to a new linux group, you need to logout and login those users, for those changes to take effect (new group).
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f377362%2fin-nixos-how-to-add-a-user-to-the-sudoers-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Firstly, adding the user with useradd
and editing users.extraUsers is redundant. I've never bothered with useradd
on NixOS.
As for the sudo configuration, what you do is set the attribute to a string containing what you'd normally put into sudoers.
...
security.sudo.configFile = ''
Sudoers config goes here
''
...
Thank you. I added "security.sudo.configFile = ''%wheel ALL=(ALL) ALL''" to /etc/nixos/configuration.nix and that did not work, but then I ran the command "$ usermod -a -G matthew wheel" and that did work.
– mherzl
Jul 10 '17 at 4:06
add a comment |
Firstly, adding the user with useradd
and editing users.extraUsers is redundant. I've never bothered with useradd
on NixOS.
As for the sudo configuration, what you do is set the attribute to a string containing what you'd normally put into sudoers.
...
security.sudo.configFile = ''
Sudoers config goes here
''
...
Thank you. I added "security.sudo.configFile = ''%wheel ALL=(ALL) ALL''" to /etc/nixos/configuration.nix and that did not work, but then I ran the command "$ usermod -a -G matthew wheel" and that did work.
– mherzl
Jul 10 '17 at 4:06
add a comment |
Firstly, adding the user with useradd
and editing users.extraUsers is redundant. I've never bothered with useradd
on NixOS.
As for the sudo configuration, what you do is set the attribute to a string containing what you'd normally put into sudoers.
...
security.sudo.configFile = ''
Sudoers config goes here
''
...
Firstly, adding the user with useradd
and editing users.extraUsers is redundant. I've never bothered with useradd
on NixOS.
As for the sudo configuration, what you do is set the attribute to a string containing what you'd normally put into sudoers.
...
security.sudo.configFile = ''
Sudoers config goes here
''
...
answered Jul 10 '17 at 1:35
Emmanuel RosaEmmanuel Rosa
3,8491 gold badge8 silver badges13 bronze badges
3,8491 gold badge8 silver badges13 bronze badges
Thank you. I added "security.sudo.configFile = ''%wheel ALL=(ALL) ALL''" to /etc/nixos/configuration.nix and that did not work, but then I ran the command "$ usermod -a -G matthew wheel" and that did work.
– mherzl
Jul 10 '17 at 4:06
add a comment |
Thank you. I added "security.sudo.configFile = ''%wheel ALL=(ALL) ALL''" to /etc/nixos/configuration.nix and that did not work, but then I ran the command "$ usermod -a -G matthew wheel" and that did work.
– mherzl
Jul 10 '17 at 4:06
Thank you. I added "security.sudo.configFile = ''%wheel ALL=(ALL) ALL''" to /etc/nixos/configuration.nix and that did not work, but then I ran the command "$ usermod -a -G matthew wheel" and that did work.
– mherzl
Jul 10 '17 at 4:06
Thank you. I added "security.sudo.configFile = ''%wheel ALL=(ALL) ALL''" to /etc/nixos/configuration.nix and that did not work, but then I ran the command "$ usermod -a -G matthew wheel" and that did work.
– mherzl
Jul 10 '17 at 4:06
add a comment |
My guess is that in your case, the problem comes from the fact that you created the same user both imperatively (with useradd
) and declaratively (in configuration.nix
).
First of all, make sure that you run nixos-rebuild switch
after each change to /etc/nixos/configuration.nix
. Second, if that is not enough, it is probably that the options that you passed declaratively cannot be used given that the user was already created. In which case, removing the user first and running nixos-rebuild switch
then should solve the issue.
Might be needed to log out/in or at least open a new login shell too? In my experience that's often needed for changes that involve group changes.
– olejorgenb
Jul 10 '17 at 14:11
Indeed, that's probably the case. On a fast laptop, I would even consider doingnixos-rebuild boot
followed byreboot
.
– Zimm i48
Jul 10 '17 at 14:16
Thank you @Zimmi48. I was rebooting after each change to /etc/nixos/configuration.nix, but running 'nixos-rebuild switch' is much faster. And also, from the output I was able to identify a syntax error in my .../configuration.nix which seemed to be causing my user to not be added to the wheel group.
– mherzl
Jul 10 '17 at 17:09
Note that rebooting alone doesn't do any good. It needs to be preceded bynixos-rebuild boot
ornixos-rebuild switch
– Zimm i48
Jul 10 '17 at 17:11
add a comment |
My guess is that in your case, the problem comes from the fact that you created the same user both imperatively (with useradd
) and declaratively (in configuration.nix
).
First of all, make sure that you run nixos-rebuild switch
after each change to /etc/nixos/configuration.nix
. Second, if that is not enough, it is probably that the options that you passed declaratively cannot be used given that the user was already created. In which case, removing the user first and running nixos-rebuild switch
then should solve the issue.
Might be needed to log out/in or at least open a new login shell too? In my experience that's often needed for changes that involve group changes.
– olejorgenb
Jul 10 '17 at 14:11
Indeed, that's probably the case. On a fast laptop, I would even consider doingnixos-rebuild boot
followed byreboot
.
– Zimm i48
Jul 10 '17 at 14:16
Thank you @Zimmi48. I was rebooting after each change to /etc/nixos/configuration.nix, but running 'nixos-rebuild switch' is much faster. And also, from the output I was able to identify a syntax error in my .../configuration.nix which seemed to be causing my user to not be added to the wheel group.
– mherzl
Jul 10 '17 at 17:09
Note that rebooting alone doesn't do any good. It needs to be preceded bynixos-rebuild boot
ornixos-rebuild switch
– Zimm i48
Jul 10 '17 at 17:11
add a comment |
My guess is that in your case, the problem comes from the fact that you created the same user both imperatively (with useradd
) and declaratively (in configuration.nix
).
First of all, make sure that you run nixos-rebuild switch
after each change to /etc/nixos/configuration.nix
. Second, if that is not enough, it is probably that the options that you passed declaratively cannot be used given that the user was already created. In which case, removing the user first and running nixos-rebuild switch
then should solve the issue.
My guess is that in your case, the problem comes from the fact that you created the same user both imperatively (with useradd
) and declaratively (in configuration.nix
).
First of all, make sure that you run nixos-rebuild switch
after each change to /etc/nixos/configuration.nix
. Second, if that is not enough, it is probably that the options that you passed declaratively cannot be used given that the user was already created. In which case, removing the user first and running nixos-rebuild switch
then should solve the issue.
answered Jul 10 '17 at 12:15
Zimm i48Zimm i48
3961 silver badge10 bronze badges
3961 silver badge10 bronze badges
Might be needed to log out/in or at least open a new login shell too? In my experience that's often needed for changes that involve group changes.
– olejorgenb
Jul 10 '17 at 14:11
Indeed, that's probably the case. On a fast laptop, I would even consider doingnixos-rebuild boot
followed byreboot
.
– Zimm i48
Jul 10 '17 at 14:16
Thank you @Zimmi48. I was rebooting after each change to /etc/nixos/configuration.nix, but running 'nixos-rebuild switch' is much faster. And also, from the output I was able to identify a syntax error in my .../configuration.nix which seemed to be causing my user to not be added to the wheel group.
– mherzl
Jul 10 '17 at 17:09
Note that rebooting alone doesn't do any good. It needs to be preceded bynixos-rebuild boot
ornixos-rebuild switch
– Zimm i48
Jul 10 '17 at 17:11
add a comment |
Might be needed to log out/in or at least open a new login shell too? In my experience that's often needed for changes that involve group changes.
– olejorgenb
Jul 10 '17 at 14:11
Indeed, that's probably the case. On a fast laptop, I would even consider doingnixos-rebuild boot
followed byreboot
.
– Zimm i48
Jul 10 '17 at 14:16
Thank you @Zimmi48. I was rebooting after each change to /etc/nixos/configuration.nix, but running 'nixos-rebuild switch' is much faster. And also, from the output I was able to identify a syntax error in my .../configuration.nix which seemed to be causing my user to not be added to the wheel group.
– mherzl
Jul 10 '17 at 17:09
Note that rebooting alone doesn't do any good. It needs to be preceded bynixos-rebuild boot
ornixos-rebuild switch
– Zimm i48
Jul 10 '17 at 17:11
Might be needed to log out/in or at least open a new login shell too? In my experience that's often needed for changes that involve group changes.
– olejorgenb
Jul 10 '17 at 14:11
Might be needed to log out/in or at least open a new login shell too? In my experience that's often needed for changes that involve group changes.
– olejorgenb
Jul 10 '17 at 14:11
Indeed, that's probably the case. On a fast laptop, I would even consider doing
nixos-rebuild boot
followed by reboot
.– Zimm i48
Jul 10 '17 at 14:16
Indeed, that's probably the case. On a fast laptop, I would even consider doing
nixos-rebuild boot
followed by reboot
.– Zimm i48
Jul 10 '17 at 14:16
Thank you @Zimmi48. I was rebooting after each change to /etc/nixos/configuration.nix, but running 'nixos-rebuild switch' is much faster. And also, from the output I was able to identify a syntax error in my .../configuration.nix which seemed to be causing my user to not be added to the wheel group.
– mherzl
Jul 10 '17 at 17:09
Thank you @Zimmi48. I was rebooting after each change to /etc/nixos/configuration.nix, but running 'nixos-rebuild switch' is much faster. And also, from the output I was able to identify a syntax error in my .../configuration.nix which seemed to be causing my user to not be added to the wheel group.
– mherzl
Jul 10 '17 at 17:09
Note that rebooting alone doesn't do any good. It needs to be preceded by
nixos-rebuild boot
or nixos-rebuild switch
– Zimm i48
Jul 10 '17 at 17:11
Note that rebooting alone doesn't do any good. It needs to be preceded by
nixos-rebuild boot
or nixos-rebuild switch
– Zimm i48
Jul 10 '17 at 17:11
add a comment |
Adding a user to the wheel
group should be sufficient to gain sudo privileges.
After you've added a user to a new linux group, you need to logout and login those users, for those changes to take effect (new group).
add a comment |
Adding a user to the wheel
group should be sufficient to gain sudo privileges.
After you've added a user to a new linux group, you need to logout and login those users, for those changes to take effect (new group).
add a comment |
Adding a user to the wheel
group should be sufficient to gain sudo privileges.
After you've added a user to a new linux group, you need to logout and login those users, for those changes to take effect (new group).
Adding a user to the wheel
group should be sufficient to gain sudo privileges.
After you've added a user to a new linux group, you need to logout and login those users, for those changes to take effect (new group).
edited 5 hours ago
answered Feb 4 at 23:41
Chris StryczynskiChris Stryczynski
9837 silver badges21 bronze badges
9837 silver badges21 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f377362%2fin-nixos-how-to-add-a-user-to-the-sudoers-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Breadcrumb: nixos.org/nixos/manual/#sec-user-management
– Jeff Schaller♦
Jul 9 '17 at 23:33
@JeffSchaller thanks for the comment; I've tried following the instructions on that page. That is, I added the 'users.extraUsers.matthew' block to my '/etc/nixos/configuration.nix' and also ran 'useradd -m matthew' and 'su - alice -c "true"', and set password and all. Still getting the 'not in sudoers file' error.
– mherzl
Jul 10 '17 at 0:52
It's odd that this doesn't work. I happen to be working with a fresh NixOS install today, and adding
"wheel"
toextraGroups
worked just fine. Note that it'sextraGroups
and notextragroups
.– shadowtalker
Sep 6 '18 at 15:09