Editing Reverse ssh

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 35: Line 35:
== Scripts & Files ==
== Scripts & Files ==
-
 
+
* [[Image:Reverse_ssh.sh]] - This file should be located in <code>/usr/share</code>, you also need to edit it with the correct ports and hostname.
-
'''All files need to have executable permissions''' (<code>chmod +x filename</code>, or <code>chmod 755 filename</code>)
+
* [[Image:Reverse ssh stop.sh]] - This file should also be in <code>/usr/share</code>.
-
 
+
* [[Image:Reverse ssh if down.sh]] - This file should be in <code>/etc/network/if-down.d/</code> - After copying this file, remove the .sh extension.
-
=== reverse_ssh.sh ===
+
* [[Image:Reverse ssh if up.sh]] - This file should be in <code>/etc/network/if-up.d/</code> - After copying this file, remove the .sh extension.
-
 
+
* '''All files need to have executable permissions''' (chmod -x filename, or chmod 755 filename)
-
This file should be located in <code>/usr/share</code>, you also need to edit it with the correct ports and hostname.
+
-
<source lang="bash">
+
-
#!/bin/sh
+
-
 
+
-
echo "Script starting"
+
-
while true; do ssh -N -C -p 22 -R 2222:127.0.0.1:22 myHostname.no-ip.info > /var/log/reverse_ssh.log; sleep 5; done
+
-
</source>
+
-
 
+
-
=== reverse_ssh_stop.sh ===
+
-
 
+
-
This file should also be in <code>/usr/share</code>.
+
-
<source lang="bash">
+
-
#!/bin/sh
+
-
 
+
-
killall reverse_ssh.sh
+
-
 
+
-
for i in `ps aux | grep -i "ssh -n" | grep -v grep | awk '{print $1}' ` ; do
+
-
        kill -9 $i
+
-
done
+
-
</source>
+
-
 
+
-
=== reverse_ssh_if_down ===
+
-
 
+
-
This file should be in <code>/etc/network/if-down.d/</code>
+
-
<source lang="bash">
+
-
#!/bin/sh
+
-
 
+
-
nohup /usr/share/reverse_ssh_stop.sh > /var/log/reverse_ssh_if_down.log &
+
-
</source>
+
-
 
+
-
=== reverse_ssh_if_up ===
+
-
 
+
-
This file should be in <code>/etc/network/if-up.d/</code>
+
-
<source lang="bash">
+
-
#!/bin/sh
+
-
 
+
-
echo "Interface went Up"
+
-
nohup /usr/share/reverse_ssh.sh > /var/log/reverse_ssh_if_up.log &
+
-
</source>
+
== Warnings ==
== Warnings ==

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)