/bin/bash /usr/bin/expect
./alogin.sh host template
- chmod 600 alogin.conf env_passwd.sh README.md
- chmod 700 alogin.sh
alogin.conf
- # template_name:service:port:user:password
- # service = ssh or telnet
- # password = password or $ for environment variable $TEMPLATE_NAME
- mail:ssh:22:my_user:my_password
- switch:telnet:23:my_user:my_password
- mail.myhost.com:ssh:22:my_user:my_password
- envar:ssh:22:my_user:$
- ./alogin.sh mail.example-one.com
- ./alogin.sh mail.example-two.com
switch
- ./alogin.sh campus-switch.example.com
- ./alogin.sh library-switch.example.com
mail.myhost.com template more specific than "mail"
- ./alogin.sh mail.myhost.com
envar, store the password in $TEMPLATE_NAME environment variable
- source env_passwd.sh
- env_passwd envar
- ./alogin.sh server.example.com envar
Warning: keep your passwords in a safe place, use the right permissions and keep in mind that root can read anything!