refactor: finish moving ssh-* scripts to own installers
[webi-installers/.git] / setcap-netbind / README.md
1 ---
2 title: setcap-netbind
3 homepage: https://github.com/webinstall/webi-installers/setcap-netbind/
4 tagline: |
5   setcap-netbind: Give a binary the ability to bind to privileged ports.
6 ---
7
8 ## Cheat Sheet
9
10 > Because no one can ever remember `setcap 'cap_net_bind_service=+ep'`.
11 > Everybody has to look it up. Every. Time.
12 >
13 > Well... not anymore.
14 >
15 > `setcap-netbind` does that ^^, plus it follows links - which is nice.
16
17 Gives a command permission to run on privileged ports (80, 443, etc).
18
19 ```txt
20 Usage:
21     sudo setcap-netbind <COMMAND>
22
23 Example:
24     sudo setcap-netbind node
25 ```
26
27 `setcap-netbind` will grant the specified program the ability to listen on
28 privileged ports, such as 80 (http) and 443 (https) without root privileges or
29 `sudo`. It seeks out the specified binary in your path and reads down symlinks
30 to make usage as painless as possible.
31
32 **_Note_**: Capability binding is specific to a particular binary file. You'll
33 need to rerun `setcap-netbind <COMMAND>` each time you upgrade or reinstall a
34 command.
35
36 # How to use plain setcap
37
38 These two commands are equivalent:
39
40 ```bash
41 sudo setcap-netbind node
42 ```
43
44 ```bash
45 sudo setcap 'cap_net_bind_service=+ep' "$(readlink -f "$(command -v node)")"
46 ```
47
48 The benefit of `setcap-netbind` is simply that it's easier to remember (and will
49 auto-complete with tab), and it will follow symbolic links. \
50 (`setcap` will not work on symlinks - probably as a security measure)
51
52 <!--
53
54 # Security
55
56 This is intended for use on single-user Desktops, single-user VPS systems,
57 ephemeral cloud instances, etc.
58
59 (note to self: not sure how to say this because it won't matter to most people
60 and could sound scary - yet their alternative solution is probably much worse,
61 so... probably best to let them use this and be _more_ secure than scare them
62 with the nuance details - if you know, you know... y'know?)
63
64 -->