쉘스크립트 – 암호 자동 입력하기
1.
1 2 3 4 5 6 7 8 9 |
#!/usr/bin/expect spawn scp temp.txt my@127.0.0.1:./directory/ expect -re "Password:" sleep 1 send "YOURPASSWORD\r" interact |
출처: http://kldp.org/node/46806
2.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#!/bin/sh tpipe() { sleep 3;echo 'user' sleep 1;echo 'passwd' sleep 1;echo 'who' sleep 1;echo 'exit' sleep 5 } tpipe | telnet localhost |