Browse Source

Add documentation to run as normal user

Shanti Bouchez-Mongardé 9 years ago
parent
commit
d2c025bf11
2 changed files with 39 additions and 4 deletions
  1. 20 0
      doc/autostart-at-login.md
  2. 19 4
      doc/non-root-user.md

+ 20 - 0
doc/autostart-at-login.md

@@ -0,0 +1,20 @@
+Autostart cjdns when you log-in
+===============================
+
+You can configure your session to autostart cjdroute when you log-in to your
+computer. Just add a file in `~/.config/autostart/cjdoute.desktop` containing:
+
+    [Desktop Entry]
+    Comment=
+    Terminal=false
+    Name=cjdroute
+    Exec=xterm -class cjdroute -e bash -c '...path/to/cjdns/cjdroute <~/.config/cjdns/cjdroute.conf; echo "Terminated ($?)"; read'
+    Categories=Network
+    Keywords=cjdns
+    StartupWMClass=cjdroute
+    Type=Application
+    Icon=modem
+    Version=1.0
+
+As you can see, you should put your cjdroute configuration in
+`~/.config/cjdns/cjdroute.conf`.

+ 19 - 4
doc/non-root-user.md

@@ -1,4 +1,11 @@
-# Run cjdns as a non-root user
+Run cjdns as a non-root user
+============================
+
+There are two ways to run cjdns as a non-root user. You might need this if you
+want to run cjdns on OpenVZ or start the network as a normal user.
+
+Method 1: Setup the tun interface ahead of time (required for OpenVZ)
+---------------------------------------------------------------------
 
 If you are using an OpenVZ based VPS then you will need to use this as OpenVZ
 does not permit persistent tunnels.
@@ -12,7 +19,7 @@ Create a new TUN device and give the cjdns user authority to access it:
     sudo /sbin/ip tuntap add mode tun user cjdns dev cjdroute0
 
 
-## 4b-1: Setup the interface manually
+### 4b-1: Setup the interface manually
 
 Run those commands to prepare your TUN device:
 
@@ -24,7 +31,7 @@ These commands should be executed as root now every time the system restarts.
 You might also want to place these commands in /etc/rc.local if your system
 supports it.
 
-### Old versions of iproute2
+#### Old versions of iproute2
 
 If you see an error when running /sbin/ip, your version of iproute2 might be
 old.
@@ -35,10 +42,18 @@ old.
 The fix: for now grab a copy of a newer `ip` binary and copy it to your home
 directory. Replacing the system binaries is not likely a good idea.
 
-## 4b-2: Fire it up!
+### 4b-2: Fire it up!
 
     sudo -u cjdns ./cjdroute < cjdroute.conf
 
 To delete a tunnel, use this command:
 
     sudo /sbin/ip tuntap del mode tun <name of tunnel>
+
+Method 2: Give the capabilities to create the tun device to the cjdroute executable
+-----------------------------------------------------------------------------------
+
+Run this command as root after building (and every time you rebuild cjdroute):
+
+    setcap "cap_net_admin+eip cap_net_raw+eip" cjdroute
+