I understand that this question has been asked several times, but I could not find the answer anywhere in my search.
I work in a development environment where security is not a problem, and anyone could just guess the password if I thought for a few seconds.
What I'm trying to do is simple. I created an alias function in my local .bashrc file, and I would like this function to automatically log in with the default password.
My current implementation looks something like this:
function s () { ssh root@192.168.1.$1 }
When I run it, I get something like this:
~]s 122 ssh root@192.168.1.122 root@192.168.1.122 password:
Using Bash and not using RSA keys, I would like this to use the default password password.
I tried the following when IP and User are already set.
Do=$(expect -c " spawn ssh $User@${IP[0]}.${IP[1]}.${IP[2]}.${IP[3]} expect \"yes/no\" send \"yes\r\" expect \"assword\" send \"password\"") echo $Do $Do
It gives the following error:
Connecting and logging into server using expect usage: send [args] string while executing "send" invoked from within "expect "assword" send "password"" Administrator@192.168.1.176 password: bash: spawn: command not found...
Using the following command, I can connect the machine. If I remove the interaction, it will simply run the uptime command and close the connection. With the help of the interaction team, I cannot see what I am typing or actually interacting with the machine. Any ideas?
Do=$(expect -c "spawn ssh $User@${IP[0]}.${IP[1]}.${IP[2]}.${IP[3]}; set timeout 4; expect \"assword\"; send \"password\n\"; expect \"test\"; send \"uptime\n\"; interact;");echo $Do;
bash ssh
SuperTetelman Nov 08 2018-12-12T00: 00Z
source share