diff options
author | An-Cheng Huang <ancheng@sydney.vyatta.com> | 2007-10-24 10:01:04 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@sydney.vyatta.com> | 2007-10-24 10:01:04 -0700 |
commit | 1229e8c6f130c62c42900f424a772d4e9c5e8ef5 (patch) | |
tree | a89f7b29d4a7e62c803f3b0306922777681f319a /templates/service/ssh | |
parent | b1fcb904eab1425d349fd7ab8d65b39c1bfb2e3f (diff) | |
download | vyatta-cfg-system-1229e8c6f130c62c42900f424a772d4e9c5e8ef5.tar.gz vyatta-cfg-system-1229e8c6f130c62c42900f424a772d4e9c5e8ef5.zip |
add 'sudo' for 'system' and 'service/ssh' configuration commands.
Diffstat (limited to 'templates/service/ssh')
-rw-r--r-- | templates/service/ssh/node.def | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/templates/service/ssh/node.def b/templates/service/ssh/node.def index df868743..17e9b3dd 100644 --- a/templates/service/ssh/node.def +++ b/templates/service/ssh/node.def @@ -1,14 +1,17 @@ help: "Enable/disable SSH protocol" -delete: "/usr/sbin/invoke-rc.d ssh stop; echo 'SSHD_OPTS=' > /etc/default/ssh" +delete: "sudo /usr/sbin/invoke-rc.d ssh stop && \ + sudo sh -c \"echo 'SSHD_OPTS=' > /etc/default/ssh\" " end: "if [ -z \"$(port/@)\" ]; then exit 0; fi; \ - [ -f /etc/ssh/ssh_host_key ] \ - || ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key; \ + sudo sh -c \ + \"[ -f /etc/ssh/ssh_host_key ] \ + || sudo ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key\"; \ case \"$(protocol-version/@)\" in \ v2) VER=2;; \ v1) VER=1;; \ all) VER=\"1,2\";; \ *) VER=2;; \ esac; \ - echo 'SSHD_OPTS=\"-p $(port/@) -o HostKey=/etc/ssh/ssh_host_key \ --o Protocol='\\\$VER\\\" > /etc/default/ssh; \ - /usr/sbin/invoke-rc.d ssh restart" + STR=\"SSHD_OPTS=\\\"-p $(port/@) -o HostKey=/etc/ssh/ssh_host_key \ +-o Protocol=\\\${VER}\\\"\"; \ + sudo sh -c \"echo '\\\$STR' > /etc/default/ssh\"; \ + sudo /usr/sbin/invoke-rc.d ssh restart" |