No one sees the real me

仮想化PF基盤SE

RSHスクリプト基本

[root@naoki2 naoki]# cat test.sh
#!/usr/bin/expect

set timeout 5
spawn ssh root@192.168.11.104
expect "Enter passphrase for key"
send "P@ssw0rd\n"
expect "Last login"
send "ls -l\n"
interact
[root@naoki2 naoki]# chmod 755 test.sh  
[root@naoki2 naoki]# ./test.sh  
spawn ssh root@192.168.11.104  
root@192.168.11.104\'s password:  
Last login: Mon Oct 24 01:16:00 2016 from 192.168.11.105  
ls -l  
[root@naoki3 ~]# ls -l  
total 532  
-rw-------. 1 root root   1435 Sep 29 07:44 anaconda-ks.cfg  
-rwxr-xr-x. 1 root root  44115 Sep 29 09:22 certbot-auto  
-rw-r--r--. 1 root root  14540 Nov  6  2012 epel-release-latest-6.noarch.rpm  
-rw-r--r--. 1 root root 430080 Oct  2 13:07 install  
-rw-r--r--. 1 root root  36519 Sep 29 07:44 install.log  
-rw-r--r--. 1 root root   7572 Sep 29 07:43 install.log.syslog  
[root@naoki3 ~]#