1. su --help
-c, --command=COMMAND pass a single COMMAND to the shell with -c
eg. sudo su -c "chmod 755 -R/opt/apache-tomcat-7.0.30_1"
http://www.computerhope.com/unix/usu.htm
2.可以sudo的前提,这里的user叫admin
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
admin ALL=(ALL) ALL
3.sudo不需要输入密码的方法
Vi /etc/sudoers
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
admin ALL = NOPASSWD:ALL
也可以限定哪些可以不要需要密码
admin ALL=(ALL)NOPASSWD:/bin/su,/bin/sudo,/sbin/su,/sbin/sudo,/bin/bash