Blob


1 IMPORTANT
2 =========
4 This is a copy of garotosopa's xodo repository since he deleted the repo. Do not bother him with pull requests, bugs, etc! Of course, the original copyright stays intact!
6 xodo
7 ====
9 Execute commands in Xorg as another user.
11 ## Getting started
13 $ ftp https://raw.githubusercontent.com/garotosopa/xodo/master/xodo.sh
14 $ chmod +x xodo.sh
15 $ doas mv -i xodo.sh /usr/local/bin/xodo
17 If you don't have `doas` privilege for this, become `root` and copy the file accordingly.
19 ## Usage
21 $ doas xodo --setup firefox
22 $ xodo firefox
24 If you don't have `doas` privilege for the initial setup, become `root` and setup `xodo` with the `--for` option as described further below.
26 ## Command-line options
28 xodo <command> [--as <user>]
29 xodo --setup <command> [--as <user>] [--for <user>]
30 xodo --help
32 ## Description
34 The `xodo` utility authorizes another user to connect to the active Xorg display, then executes the given command as this other user. It's been developed to ease the steps for running desktop programs with different privileges than your own, so that a vulnerability doesn't compromise anything other than the program itself.
36 Essentially, all `xodo` does is call `xauth` and `doas`, and it can also configure new users automatically with the `--setup` option.
38 Before using `xodo` for executing a program, another user must exist, preferably for the sole purpose of running said program. It can be created either manually or using the `--setup` option, and the main user that's going to execute `xodo` must be allowed in `doas.conf` to execute the given command as this other user. This is already taken care of when using `xodo`'s `--setup` option. Unless told otherwise, this other user defaults to `<user>-<command>`.
40 The command argument is mandatory and can either be an absolute or relative path, or just the command basename. In this latter case, the command is assumed to be in the current `PATH`. Arguments to the command being executed are not supported yet.
42 Supported options are as follows:
44 ### --as <user>
46 When specified, this is the user as which the command is going to be executed, or the user that's going to be created when invoked with the `--setup` option.
48 When ommitted, the convention assumes `<user>-<command>`. During setup, the username part can be overriden with the `--for` option. Otherwrise, the `$USER` environment variable is used.
50 ### --for <user>
52 When specified, this is the user that will be allowed to execute the command as another user. This options is only used with `--setup` for adding an entry to `doas.conf`.
54 When ommitted, the current username in the `$USER` environment variable is used.
56 ### --help<br>-h
58 Display basic usage syntax.
60 ### --setup <command>
62 Adds a new user and authorizes the current user to execute the given command as this new user, by appending an entry to `doas.conf`. The current user is also added to the new user's own group, in order to have access to its files.
64 If the new user already exists, no user is added and the current user is not added to any group, but `doas.conf` still gets a new entry.
66 Options `--as` and `--for` overrides the username being created and the existing user that will be allowed to execute the command, respectively.
68 This option must be used as `root`, as it calls `useradd` and `usermod`, and writes to `/etc/doas.conf`.
70 ## Examples
72 Configure a separate user for Mike to execute Firefox:
74 mike$ doas xodo --setup firefox
76 This assumes that Mike is permitted in `doas.conf` to execute `xodo` as ` root`. If that's not so, `root` should be used directly for setting this up for Mike:
78 root# xodo --setup firefox --for mike
80 Either way, now Mike can execute Firefox as the user **mike-firefox**, so
81 that any vulnerability in Firefox wouldn't compromise Mike's files:
83 mike$ xodo firefox
85 To create a user different than the `<user>-<command>` convention, use the `--as` option during setup:
87 root# xodo --setup firefox --for mike --as mike-web
89 Then specify this different user when executing `xodo`:
91 mike$ xodo firefox --as mike-web
93 ## See also
95 * [doas(1)](http://man.openbsd.org/OpenBSD-current/man1/doas.1)
96 * [doas.conf(5)](http://man.openbsd.org/OpenBSD-current/man5/doas.conf.5)
97 * [xauth(1)](http://man.openbsd.org/OpenBSD-current/man1/xauth.1)