Using SSH with xagrs. Pseudo-terminal will not be allocated because stdin is not a terminal

Viewed 25

have been trying to do something like cat file | awk '{print $2}' | xargs ssh and it's possible to login (prompted for a password but displayed Pseudo-terminal will not be allocated because stdin is not a terminal.). if I pass the -tt argument to ssh it will give me a shell but it's just froze (unable to write anything to the shell). my questing is simply if it's possible to pass arguments to ssh using xargs or pipe? (such that ssh's stdin or argument is stdout of another command NOT the shell)?

I know it's possible to do something like ssh `cat somefile` assuming that somefile contains something like username@server, at the first line.

1 Answers

I would recommend that you don't use password authentication, but one of the other forms of authentication SSH provides:

  • Host-based authentication, or more preferrably
  • Public key authentication.

If both don't work for you, ssh-askpass or an alternative with setting the environment variable SSH_ASKPASS could be an option. Still I would not recommend that as you seem to be reading the passwords from a cleartext file now and probably would keep that.

Related