how to login into a remote host through ssh
1, write a shell script (login.sh), like:
#!/usr/bin/expect -f
set user root
set host 192.168.2.1
set password yourpasswd
set timeout -1
spawn ssh $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof
2, run the following command in a terminal
#this will run the shell script
expect ./login.sh
3, you can even do this with iTerms2
iTerms is a great alternative for the built-in terminal on MacOS. You can add in many sessions.