Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:guides:network-script [2010/05/04 16:57] jozee |
en:guides:network-script [2014/11/15 21:00] linea updated (thanks K3nn3th) |
||
---|---|---|---|
Line 62: | Line 62: | ||
For user tux, which must use network.sh from every host; without a password you should add: | For user tux, which must use network.sh from every host; without a password you should add: | ||
- | <code bash> | + | <file> |
tux ALL=NOPASSWD: /etc/init.d/network.sh, | tux ALL=NOPASSWD: /etc/init.d/network.sh, | ||
- | </code> | + | </file> |
For user tortux, which may only get connected from localhost, and which should use a password each time, you should add: | For user tortux, which may only get connected from localhost, and which should use a password each time, you should add: | ||
- | <code bash> | + | <file> |
tortux my_hostname=PASSWD: /etc/init.d/network.sh, | tortux my_hostname=PASSWD: /etc/init.d/network.sh, | ||
- | </code> | + | </file> |
If you forgot your hostname, just run: | If you forgot your hostname, just run: | ||
Line 97: | Line 97: | ||
# (This script is only useful if sudo is installed, and correctly configured) | # (This script is only useful if sudo is installed, and correctly configured) | ||
- | echo '' | + | echo '<openbox_pipe_menu>' |
# for default file: | # for default file: | ||
- | echo '' | + | echo '<item label="Load Default network.conf">' |
- | echo '' | + | echo -n '<action name="Execute"><execute>' |
- | echo 'sudo /etc/init.d/network.sh restart' | + | echo -n "sudo /etc/init.d/network.sh restart" |
- | echo '' | + | echo '</execute></action>' |
+ | echo '</item>' | ||
- | # for others files: | + | # for other configuration files (you may state a different directory here |
- | for file in $(ls /etc/network/) | + | # depending on your setup): |
- | do | + | # e.g nice for frugal installs: |
- | echo -e "" | + | # ls /home/tux/network/ | while read; do |
- | echo '' | + | ls /etc/network/ | while read; do |
- | echo "sudo /etc/init.d/network.sh restart /etc/network/$file" | + | echo '<item label="'"${REPLY}"'">' |
- | echo '' | + | echo -n '<action name="Execute"><execute>' |
- | done | + | echo -n "sudo /etc/init.d/network.sh restart '/etc/network/${REPLY}'" |
+ | echo '</execute></action>' | ||
+ | echo '</item>' | ||
+ | done | ||
# To stop connections: | # To stop connections: | ||
- | echo '' | + | echo '<item label="stop Connection">' |
- | echo '' | + | echo -n '<action name="Execute"><execute>' |
- | echo 'sudo /etc/init.d/network.sh stop' | + | echo -n "sudo /etc/init.d/network.sh stop" |
- | echo '' | + | echo '</execute></action>' |
+ | echo '</item>' | ||
- | echo '' | + | echo '</openbox_pipe_menu>' |
</code> | </code> | ||
Line 131: | Line 136: | ||
And now you only have to add these lines in //~/.config/openbox/menu.xml//: | And now you only have to add these lines in //~/.config/openbox/menu.xml//: | ||
- | <code bash> | + | <file> |
- | menu id="network-menu" label="Network" | + | <menu id="network-menu" label="Network" |
execute="/usr/lib/openbox/network-menu.sh" /> | execute="/usr/lib/openbox/network-menu.sh" /> | ||
- | </code> | + | </file> |
Then reconfigure openbox: | Then reconfigure openbox: |