summaryrefslogtreecommitdiff
path: root/templates/service/telnet/node.def
diff options
context:
space:
mode:
Diffstat (limited to 'templates/service/telnet/node.def')
-rw-r--r--templates/service/telnet/node.def20
1 files changed, 17 insertions, 3 deletions
diff --git a/templates/service/telnet/node.def b/templates/service/telnet/node.def
index 5f4c1c7c..844aec98 100644
--- a/templates/service/telnet/node.def
+++ b/templates/service/telnet/node.def
@@ -1,4 +1,18 @@
help: "Enable/disable telnet protocol"
-delete: "sudo /opt/vyatta/sbin/telnetd.init stop"
-end: "if [ -z \"$(port/@)\" ]; then exit 0; fi; \
- sudo /opt/vyatta/sbin/telnetd.init restart $(port/@)"
+delete: " \
+ if ! env | grep -q SSH_TTY=; then \
+ if [[ \"`tty`\" == /dev/pts/* ]]; then \
+ echo \"Please configure telnet settings via ssh or console.\"; \
+ exit 1; \
+ fi; \
+ fi; \
+ sudo /opt/vyatta/sbin/telnetd.init stop"
+end: " \
+ if ! env | grep -q SSH_TTY=; then \
+ if [[ \"`tty`\" == /dev/pts/* ]]; then \
+ echo \"Please configure telnet settings via ssh or console.\"; \
+ exit 1; \
+ fi; \
+ fi; \
+ if [ -z \"$(port/@)\" ]; then exit 0; fi; \
+ sudo /opt/vyatta/sbin/telnetd.init restart $(port/@)"