Skip to content

Commit ea39056

Browse files
committed
Update README
1 parent 4d0c5ce commit ea39056

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ This requires [`libcap-ng`](https://github.com/stevegrubb/libcap-ng), which can
44

55
$ apt install libcap-ng-dev
66

7-
To compile:
7+
To compile, you should specify a binary by setting the `EXEC_BIN` macro to the absolute path of the program:
88

99
$ gcc -o capsh -DEXEC_BIN='"/sbin/capsh"' backup-exec.c -lcap-ng
1010

1111
Then add the capabilities on the resulting binary:
1212

1313
$ sudo setcap "cap_dac_read_search=+eip cap_setpcap=+ep" capsh
1414

15-
The `cap_setpcap` capability is required so that it can set the ambient capability. The ambient capability allows programs to inherit capabilities without being a privileged binary. When run, you can verify it has the capability:
15+
The `cap_setpcap` capability is required so that it can set [ambient capabilities](https://lwn.net/Articles/636533/). Ambient capabilities allows programs to inherit capabilities without running in "secure exec" mode. When run, this will run the program pointed to by `EXEC_BIN` with `CAP_DAC_READ_SEARCH`. You can verify it has the capability:
1616

1717
$ ./capsh --print
1818
Current: = cap_dac_read_search+eip
@@ -26,6 +26,10 @@ Then compile:
2626

2727
% docker run --rm -v "$PWD":/work backup-exec gcc -o capsh -DEXEC_BIN='"/sbin/capsh"' backup-exec.c -lcap-ng
2828

29-
As a more practical example, here's how to create a wrapper for the for the [Borg Backup](https://www.borgbackup.org) binary:
29+
As a more practical example, here's how to create a wrapper for the for the [Borg backup](https://www.borgbackup.org) binary:
3030

3131
$ docker run --rm -v "$PWD":/work backup-exec gcc -o build/borg -DDEBUG=1 -DEXEC_BIN='"/usr/local/libexec/borg"' backup-exec.c -lcap-ng
32+
33+
And also for [Restic backup](https://restic.net) binary:
34+
35+
$ docker run --rm -v "$PWD":/work backup-exec gcc -o build/restic -DDEBUG=1 -DEXEC_BIN='"/usr/local/libexec/restic"' backup-exec.c -lcap-ng

0 commit comments

Comments
 (0)