Skip to content

Commit 0fa0da8

Browse files
committed
README: Some usage examples
1 parent c65f0dd commit 0fa0da8

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ Usage: ./execd [options] <auth-handler> <exec-handler>
99
-d=false: debug mode displays handler output
1010
-e=false: pass environment to handlers
1111
-k="": pem file of private keys (read from SSH_PRIVATE_KEYS by default)
12+
-h="": host ip to listen on
1213
-p="22": port to listen on
1314
-s=false: run exec handler via SHELL
1415
```
16+
17+
1518
#### auth-handler $user $key
1619

1720
* `$user` argument is the name of the user being used to attempt the connection
@@ -21,12 +24,47 @@ auth-handler is the path to an executable that's used for authenticating incomin
2124

2225
Although auth-handler is required, you can still achieve no-auth open access by providing `/usr/bin/true` as auth-handler.
2326

27+
2428
#### exec-handler $command...
2529

2630
* `$command...` arguments is the command line that was specified to run by the SSH client
2731

2832
exec-handler is the path to an executable that's used to execute the command provided by the client. The meaning of that is quite flexible. All of the stdout and stderr is returned to the client, including the exit status. If the client provides stdin, that's passed to the exec-handler. Any environment variables provided by the auth-handler output will be available to exec-handler, as well as `$USER` and `$SSH_ORIGINAL_COMMAND` environment variables.
2933

34+
35+
## Examples
36+
37+
**These examples bypass all authentication and allow remote execution, *do not* run this in production.**
38+
39+
Echo server (with accept-all auth):
40+
41+
```
42+
server$ execd $(which true) $(which echo)
43+
client$ ssh $SERVER "hello world"
44+
hello world
45+
```
46+
47+
Echo host's environment to clients
48+
49+
```
50+
server$ execd -e $(which true) $(env)
51+
client$ ssh $SERVER
52+
USER=root
53+
HOME=/root
54+
LANG=en_US.UTF-8
55+
...
56+
```
57+
58+
Bash server (with accept-all auth):
59+
60+
```
61+
server$ execd $(which true) $(which bash)
62+
client$ ssh $SERVER
63+
bash-4.3$ echo "this is a bash instance running on the server"
64+
this is a bash instance running on the server
65+
```
66+
67+
3068
## Credit / History
3169

3270
It started with [gitreceive](https://github.com/progrium/gitreceive), which was then used in [Dokku](https://github.com/progrium/dokku). Then I made a more generalized version of gitreceive, more similar to execd, called [sshcommand](https://github.com/progrium/sshcommand), which eventually replaced gitreceive in Dokku. When I started work on Flynn, the first projects included [gitreceived](https://github.com/flynn/gitreceived) (a standalone daemon version of gitreceive). This was refined by the Flynn community, namely Jonathan Rudenberg.
@@ -39,4 +77,4 @@ This project was made possible thanks to [DigitalOcean](http://digitalocean.com)
3977

4078
## License
4179

42-
BSD
80+
BSD

0 commit comments

Comments
 (0)