[LINUX] I want to automate ssh using the expect command! part2

~ Continuation from the previous article ~ https://qiita.com/Naoki28/items/c77cc25585146fedd7d6

trial and error

Carry out isolation using the -vv option ssh -vv 192.168.33.10

・ ・ ・ Judging that it is difficult to find the cause from the huge output results I will try ssh connection referring to the following article

https://qiita.com/y_arakawa/items/7bb292c999873032e6a4

$ vagrant ssh-config

Write the above information in ~ / .ssh / config $ vagrant ssh-config --host 192.168.33.10 >> ~/.ssh/config

apple-no-MacBook-Pro:centos7 apple$ ssh 192.168.33.10
Last login: Fri Dec  6 13:52:44 2019 from 10.0.2.2

I referred to the article and it worked!

Main subject

I want to automate ssh using the expect command!

#!/bin/sh
  
expect -c "
set timeout 10
spawn /usr/bin/ssh 192.168.33.10
expect \"$\"
send \"ls-al\"
"

Output result spawn /usr/bin/ssh 192.168.33.10

First of all, I want to log in automatically so that I can type even one command ... Next time I plan to explore the bad parts of the migration shell

Recommended Posts

I want to automate ssh using the expect command! part2
I want to automate ssh using the expect command!
I want to handle the rhyme part1
I want to handle the rhyme part3
I want to handle the rhyme part2
I want to handle the rhyme part5
I want to handle the rhyme part4
I want to handle the rhyme part7 (BOW)
I want to handle the rhyme part6 (organize once)
I want to handle the rhyme part8 (finished once)
I want to increase the security of ssh connections
I want to connect remotely to another computer, and the nautilus command
I want to pin Spyder to the taskbar
I want to output to the console coolly
I tried to summarize the umask command
I want to display the progress bar
I want to get information from fstab at the ssh connection destination and execute a command
I want to leave an arbitrary command in the command history of Shell
I want to email from Gmail using Python.
I want to visualize csv files using Vega-Lite!
[I want to classify images using Tensorflow] (2) Let's classify images
I want to customize the appearance of zabbix
I want to use the activation function Mish
I want to display the progress in Python!
I want to be notified when the command operation is completed on linux!
I want to see the file name from DataLoader
How to write a GUI using the maya command
I want to grep the execution result of strace
I want to scroll the Django shift table, but ...
less command I want to definitely remember this [linux command]
I want to inherit to the back with python dataclass
I want to fully understand the basics of Bokeh
I tried to approximate the sin function using chainer
I want to write in Python! (3) Utilize the mock
I tried to erase the negative part of Meros
I made a command to markdown the table clipboard
What I did to ssh to the VPS Ubuntu environment
I want to publish the product at the lowest cost
I tried to identify the language using CNN + Melspectogram
I want to use the R dataset in python
I tried to complement the knowledge graph using OpenKE
I tried to compress the image using machine learning
I want to take a screenshot of the site on Docker using any font
I want to extract only pods with the specified label using Label Selector in Client-go
I want to use Linux commands at the command prompt! Use Linux commands at the command prompt instead of Git Bash
I dare to fill out the form without using selenium
[TensorFlow] I want to master the indexing for Ragged Tensor
I want to be able to analyze data with Python (Part 3)
I want to use the latest gcc without sudo privileges! !!
I want to initialize if the value is empty (python)
I want to save the photos sent by LINE to S3
maya Python I want to fix the baked animation again.
I want to move selenium for the time being [for mac]
I want to be able to analyze data with Python (Part 1)
I tried to simulate ad optimization using the bandit algorithm.
I want to start a jupyter environment with one command
Clone using the dd command
I want to use only the normalization process of SudachiPy
[For those who want to use TPU] I tried using the Tensorflow Object Detection API 2
I want to get the operation information of yahoo route
I want to change the Japanese flag to the Palau flag with Numpy