Skip to content

Commit dcd0351

Browse files
committed
Merge pull request #167 from tjanez/readme-passwordless-sudo
Improve README.md for Passwordless sudo.
2 parents c92cff0 + ef2f01c commit dcd0351

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,31 @@ end
120120
Passwordless sudo
121121
-----------------
122122

123-
Add the following snippet to the sudoers file (for example, to
124-
```/etc/sudoers.d/vagrant_hostmanager```) to make it stop asking
125-
password when updating hosts file (replace ```/home/user``` with your
126-
actual home directory):
123+
To avoid being asked for the password every time the hosts file is updated,
124+
enable passwordless sudo for the specific command that hostmanager uses to
125+
update the hosts file.
127126

128-
Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp /home/user/.vagrant.d/tmp/hosts.local /etc/hosts
129-
%sudo ALL=(root) NOPASSWD: VAGRANT_HOSTMANAGER_UPDATE
127+
- Add the following snippet to the sudoers file (e.g.
128+
`/etc/sudoers.d/vagrant_hostmanager`):
129+
130+
```
131+
Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp <home-directory>/.vagrant.d/tmp/hosts.local /etc/hosts
132+
%<admin-group> ALL=(root) NOPASSWD: VAGRANT_HOSTMANAGER_UPDATE
133+
```
134+
135+
Replace `<home-directory>` with your actual home directory (e.g.
136+
`/home/joe`) and `<admin-group>` with the group that is used by the system
137+
for sudo access (usually `sudo` on Debian/Ubuntu systems and `wheel`
138+
on Fedora/Red Hat systems).
139+
140+
- If necessary, add yourself to the `<admin-group>`:
141+
142+
```
143+
usermod -aG <admin-group> <user-name>
144+
```
145+
146+
Replace `<admin-group>` with the group that is used by the system for sudo
147+
access (see above) and `<user-name>` with you user name.
130148
131149
Windows support
132150
---------------

0 commit comments

Comments
 (0)