^ that's possible if program expects input from stdin. If it wants direct terminal input (like ssh and sudo), it's a no-go without terminal wrapper like expect. It acts as pseudo terminal (/dev/pts/X), emulating keystrokes and catching output. Target program doesn't recognize, or care, that it isn't commanded by human TTY or PTS.
ssh, sudo, pam (su) are flexible enough to authenticate a user using other means, not only via plaintext password. And aside from Expect one can also simulate write from terminal inside tmux/screen, i.e. send-keys, at + stuff.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.