Loading views...
exp ssh 자동접속

exp ssh 자동접속

Date
Date
2020 Jan 15 0:0
Created by
Created by
Seonglae ChoSeonglae Cho
Created time
Created time
2023 Feb 28 12:39
Last edited by
Last edited by
Seonglae ChoSeonglae Cho
Last edited time
Last edited time
2023 Apr 15 16:57
Refs
Refs
expect라는 녀석으로 ssh 바로 접속가능
설치는 저번에 했고 이번에 직접 접속해봤는데
 
permission denied에러 뜨면
 
  • have to change file mod
chmod 755 exp-file
 
 
아래는 예제인데 lindex 라인인덱스로 받아오는 게 중요함 전역 환경변수로 설정해두거나 여기서 환경변수 설정해서 프로젝트별 파일에 넣어두면 편할듯
 
  • simple example
#!/usr/bin/expect set timeout -1 set target_host [lindex $argv 0] set password [lindex $argv 1] spawn bash -c "ssh $target_host" expect { "password: " { send "$password\r" } } interact
 
 
expect
- 개인정리
 
 

Recommendations