3d63148c-9510-465a-994b-c8f3be15daed
prompter
On Arch Linux, how do I allow a user to use `sudo` for a specific command without that user having to use their password?  Say for example, allowing a user `josh` to use the `systemctl ...`.  It would be even nicer if the user can only use specific sub-commands of `systemctl` such as `systemctl start/stop/status`
3f8e3555-02c2-43c1-aefc-3f1e73d5fc47
3d63148c-9510-465a-994b-c8f3be15daed
assistant
To allow a user to use `sudo` for a specific command without having to enter their password on Arch Linux, you can edit the sudoers file using the `visudo` command.

1. Open a terminal and run the command `sudo visudo`. This will open the sudoers file in the nano text editor.

2. Add the following line to the end of the file to allow the user "josh" to run the "systemctl" command without a password:

```javascript
josh ALL=(ALL) NOPASSWD: /usr/bin/systemctl start, /usr/bin/systemctl stop, /usr/bin/systemctl status
```
This line allows the user "josh" to run the "systemctl start", "systemctl stop" and "systemctl status" commands as the superuser without having to enter a password.

3. Save the changes to the file by pressing `Ctrl+X`, then `Y`, and then `Enter`.

Now, the user "josh" can use the `sudo` command with the specified `systemct` sub-commands without being prompted for a password. It is important to note that editing the sudoers file can be dangerous and should be done with caution.
c6dac171-76a7-441c-b906-7d37e83fcb52
3f8e3555-02c2-43c1-aefc-3f1e73d5fc47
prompter
I wrote a macro for Vim which automatcially adds users to the sudoers file.  How do I configure `visudo` to open Vim?
57a5bb4a-47fe-41e0-bec1-2e5ab4fd5a37
c6dac171-76a7-441c-b906-7d37e83fcb52
assistant
To configure visudo to open Vim when you use the command, you will need to edit the sudoers file. You can do this by running the command sudo visudo. This will open the sudoers file in the nano text editor.

At the bottom of the file, add the line "EDITOR=/usr/bin/vim", and then press Ctrl+X, then Y, and then Enter to save the changes. Now, when you use the visudo command, it will open the sudoers file in Vim instead of nano.