Issue
I have this bash file, which asks for IP, password, etc. for OpenSSH to a device.
Now, if i use ssh root@ip
, i have to enter the password. This is really irritating. Secondly; i cannot let my script send commands to it.
This is what i want->
Not the password thing; i already found something; but it tells me the commands are not found?:
#!/usr/bin/expect -f
spawn ssh root@$IPADDR
expect "password:"
sleep 1
send "$rpass\r"
I want the user to be able to see some menus where it can choose from; after that; every command is done for him. So like a new window, or something like that?
I do not want to use: -Any external stuff -No extra editing of the SSH connection
BASH INFO: GNU Bash, v. 4.0.33(1)-release (i486-pc-linux-gnu), running on Linux Mint. But it got to be available for several linux distro's, and also on Mac?
Solution
Many tools go to great lengths to prevent what you are doing. I recommend using ssh public keys to solve this problem instead of passwords.
The big alternative is to write your own modified ssh client based on the open source so as to take control of the password management.
Oh, well, I forgot. You can probably outsmart this with a pty, since then /dev/tty will be what you control. expect
might help you with this.
Answered By - bmargulies Answer Checked By - Candace Johnson (WPSolving Volunteer)