2021-07-14 15:13:36 +02:00
# RootDO [](https://aur.archlinux.org/packages/rdo/)
2021-07-13 21:33:12 +02:00
2022-02-09 20:16:13 +01:00
This project aims to be a very slim alternative to both sudo and doas.
2021-07-13 21:33:12 +02:00
### Installation
2021-07-14 15:13:36 +02:00
If you are on Arch Linux, you can download the package via the [AUR ](https://aur.archlinux.org/packages/rdo/ ).
2022-02-09 20:16:13 +01:00
If you are using any other linux distro, or want to build it yourself, you will first need to install either `libbsd` or `libbsd-dev` , depending on how your package manager calls it.
Then, you can clone and build rdo with the following set of commands:
2021-07-14 15:13:36 +02:00
2021-07-13 21:33:12 +02:00
```sh
2021-07-13 21:34:38 +02:00
git clone https://codeberg.org/sw1tchbl4d3/rdo
2021-07-13 21:33:12 +02:00
cd rdo
make
sudo make install
```
After that, you'll have to configure rdo to allow you to use it.
2022-03-08 18:12:42 +01:00
To do this, edit `/etc/rdo.conf` , and set the group variable to the admin group you are in.
2021-07-13 21:33:12 +02:00
2022-02-09 20:16:13 +01:00
Then you're good to go!
2021-07-13 21:33:12 +02:00
2022-02-09 20:16:13 +01:00
To uninstall:
2021-07-13 21:33:12 +02:00
```sh
sudo make uninstall
```
### Usage
```sh
rdo [command]
```
2021-07-15 12:44:44 +02:00
2021-07-16 00:43:18 +02:00
The configuration file has the following variables:
```
2022-03-08 17:32:53 +01:00
group=wheel
2021-07-16 00:43:18 +02:00
wrong_pw_sleep=1000
session_ttl=5
```
2022-03-08 17:32:53 +01:00
- `group` : The group of users that is allowed to execute rdo.
2021-07-16 00:43:18 +02:00
- `wrong_pw_sleep` : The amount of milliseconds to sleep at a wrong password attempt. Must be a positive integer. Set to 0 to disable.
- `session_ttl` : The amount of minutes a session lasts. Must be a positive integer. Set to 0 to disable.
2021-07-29 18:38:33 +02:00
### Benchmarks
2021-07-29 19:10:36 +02:00
The benchmark: Execute `whoami` (GNU coreutils 8.32) 1000 times.
2021-07-29 18:38:33 +02:00
2022-03-08 18:07:44 +01:00
Yes, this is a silly benchmark. Yes, the performance gain in real world application is close to nothing.
But it's fun!
2021-07-29 18:38:33 +02:00
|Program|Time|
--- | ---
2022-03-08 18:07:44 +01:00
sudo 1.9.9 | 22.12s
opendoas 6.8.2 | 13.5s
rdo 1.4 | 3.5s
Baseline | 2.1s
2021-07-29 18:38:33 +02:00
Baseline here is how long it took without any wrapper to make it root.
2022-03-08 18:07:44 +01:00
These benchmarks were done on a single core of an `AMD FX-8350` processor, on Artix Linux version `5.16.12-zen1-1-zen` .
2021-07-29 18:38:33 +02:00
`sudo` and `opendoas` were pulled from the pacman repos, rdo via AUR.
All configs were kept as default, except allow the `wheel` group on both + enable `persist` on doas.
Script used:
```sh
#!/bin/sh
$1 whoami
current=$(date +%s.%N)
for i in {1..1000}; do
$1 whoami 2>& 1 >/dev/null
done
done=$(date +%s.%N)
echo $done - $current | bc
```
The script requires `bc` to be installed, for floating point arithmetics.