Skip to content

Commit 21f6f61

Browse files
Clean up formatting
1 parent 075801a commit 21f6f61

2 files changed

Lines changed: 39 additions & 13 deletions

File tree

README.md

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,45 @@ To avoid that and/or to get the latest version, you can use our prepackaged bina
2626
### Ubuntu 25.10 (Questing Quokka)
2727

2828
sudo-rs is installed and enabled by default; you can control which sudo version is being used by running
29+
2930
```sh
3031
update-alternatives --config sudo
3132
```
33+
3234
The sudo-rs package is based on v0.2.8 with additional bug fixes that will be part of v0.2.9.
3335

3436
### Arch Linux
3537

3638
sudo-rs can be installed from the distribution repositories:
39+
3740
```sh
3841
pacman -S sudo-rs
3942
```
43+
4044
This will offer the functionality using the commands `sudo-rs`, `sudoedit-rs`, `visudo-rs` and `su-rs` to avoid conflicts.
4145

4246
The sudo-rs package on Arch Linux is typically up-to-date.
4347

4448
### Fedora
4549

4650
On Fedora you can use:
51+
4752
```sh
4853
dnf install sudo-rs
4954
```
55+
5056
This will offer the functionality using the commands `sudo-rs`, `visudo-rs` and `su-rs` to avoid conflicts.
5157

5258
The version packaged in Fedora is usually the latest.
5359

5460
### Debian
61+
5562
If you are running Debian 13 (trixie) or later you can use:
63+
5664
```sh
5765
apt-get install sudo-rs
5866
```
67+
5968
This will offer the functionality using the commands `sudo-rs`, `visudo-rs`. If you want to invoke sudo-rs
6069
via the usual commands `sudo` and `visudo` instead, prepend `/usr/lib/cargo/bin` to your current `$PATH` variable.
6170

@@ -68,16 +77,20 @@ Debian unstable (sid) may have a newer version.
6877
### FreeBSD
6978

7079
We are maintaining the FreeBSD port of sudo-rs ourselves, which is available in the ports tree. Sudo-rs is available in two flavours:
71-
```
80+
81+
```sh
7282
pkg install sudo-rs
7383
```
84+
7485
To get sudo-rs using the commands `sudo`, `visudo` and `sudoedit`. This conflicts with the `security/sudo` package and so you cannot have both
7586
installed at the same time.
7687

7788
Alternatively,
78-
```
89+
90+
```sh
7991
pkg install sudo-rs-coexist
8092
```
93+
8194
Installs the commands as `sudo-rs`, `visudo-rs`' and `sudoedit-rs` and does not conflict with the `security/sudo` package.
8295

8396
To run these commands, the `pkg` utility needs to be using the `2025Q4` quarterly version (or later) of the ports tree. To use the
@@ -96,6 +109,7 @@ This will replace the usual `sudo` and `sudoedit` commands.
96109
### Alpine Linux
97110

98111
On Alpine Linux, sudo-rs is in the *community* repository, and can be installed as:
112+
99113
```sh
100114
apk add sudo-rs
101115
```
@@ -110,13 +124,17 @@ We currently only offer these for x86-64 Linux systems.
110124

111125
We recommend installing sudo-rs and su-rs in your `/usr/local` hierarchy so it does not affect the integrity of the package
112126
manager of your Linux distribution. You can achieve this using the commands:
127+
113128
```sh
114129
sudo tar -C /usr/local -xvf sudo-0.2.13.tar.gz
115130
```
131+
116132
and for su-rs:
133+
117134
```sh
118135
sudo tar -C /usr/local -xvf su-0.2.13.tar.gz
119136
```
137+
120138
This will install sudo-rs and su-rs in `/usr/local/bin` using the usual commands `sudo`, `visudo`, `sudoedit` and `su`. Please double check
121139
that in your default `PATH`, the folders `/usr/local/bin` and `/usr/local/sbin` have priority over `/usr/bin` and `/usr/sbin`.
122140

@@ -155,17 +173,20 @@ install translated messages, you also need gettext tools for `msgfmt` (`gettext`
155173
on Debian and Ubuntu).
156174

157175
On Ubuntu or Debian-based systems, use the following command to install the PAM development library:
158-
```
176+
177+
```sh
159178
sudo apt-get install libpam0g-dev
160179
```
161180

162181
On Fedora, CentOS and other Red Hat-based systems, you can use the following command:
163-
```
182+
183+
```sh
164184
sudo yum install pam-devel
165185
```
166186

167187
With dependencies installed, building sudo-rs is a simple matter of:
168-
```
188+
189+
```sh
169190
cargo build --release
170191
```
171192

@@ -179,20 +200,25 @@ suggestions in the previous section.
179200
### Feature flags
180201

181202
#### --features pam-login
203+
182204
By default, sudo-rs will use the PAM service name `sudo`. On Debian and Fedora
183205
systems, it is customary that the name `sudo-i` is used when the `-i / --login`
184206
command line option is used. To get this behaviour, enable the `pam-login`
185207
feature when building:
186-
```
208+
209+
```sh
187210
cargo build --release --features pam-login
188211
```
212+
189213
This feature is enabled on our pre-supplied binaries.
190214

191215
#### --features apparmor
216+
192217
sudo-rs has support for selecting AppArmor profile on Linux distributions that
193218
support AppArmor such as Debian and Ubuntu. To enable this feature, build sudo-rs
194219
with apparmor support enabled:
195-
```
220+
221+
```sh
196222
cargo build --release --features apparmor
197223
```
198224

@@ -203,13 +229,13 @@ This feature is disabled on our pre-supplied binaries.
203229
sudo-rs has support for translated user-facing messages. To enable this feature,
204230
build sudo-rs with gettext support enabled:
205231

206-
```
232+
```sh
207233
cargo build --release --features gettext
208234
```
209235

210236
You can install the translation files from `po/*.po` using:
211237

212-
```
238+
```sh
213239
sudo make install-mo
214240
```
215241

@@ -301,4 +327,4 @@ Sudo-rs is an independent implementation, but it incorporates documentation and
301327

302328
An independent security audit of sudo-rs was made possible by the [NLNet Foundation](https://nlnet.nl/), who also [sponsored](https://nlnet.nl/project/sudo-rs/) work on increased compatibility with the original sudo and the FreeBSD port.
303329

304-
The sudo-rs project would not have existed without the support of its sponsors, a full overview is maintained at https://trifectatech.org/initiatives/privilege-boundary/
330+
The sudo-rs project would not have existed without the support of its sponsors, a full overview is maintained at <https://trifectatech.org/initiatives/privilege-boundary/>

src/sudoers/policy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ impl Judgement {
147147
}
148148

149149
pub(crate) fn preferred_editor(&self) -> (PathBuf, Vec<OsString>) {
150-
//if no editor could be selected, fall back to /bin/vi;
151-
//note that /bin/vi is also likely to have been tried as part of
152-
//the "editor" setting, so this is a last-resort
150+
// if no editor could be selected, fall back to /bin/vi;
151+
// note that /bin/vi is also likely to have been tried as part of
152+
// the "editor" setting, so this is a last-resort
153153
super::select_editor(&self.settings, true)
154154
.unwrap_or_else(|| (std::path::PathBuf::from("/usr/bin/vi"), vec![]))
155155
}

0 commit comments

Comments
 (0)