0

When I ssh to a remote system and execute scp, I do not get a password prompt:

# ssh 192.168.1.32 "scp joe\@192.168.1.31:/etc/hosts /tmp"  
Permission denied, please try again.  
Permission denied, please try again.  
Permission denied (publickey,password,keyboard-interactive).

If I break it up like this, it works fine:

# ssh 192.168.1.32  
# scp joe\@192.168.1.31:/etc/hosts /tmp  
joe@192.168.1.31's password:

How can I make it prompt me for the password in the first example above?

Note: No, I cannot use key-based authentication for this.

Zek
  • 568
  • 3
  • 10
  • 24
  • The two ip hosts you are calling seem to be on the same subnet. Is there something stopping you from simply skipping the ssh part and just doing the scp part? You would still be using ssh based communication. – ErikE Nov 05 '13 at 22:13
  • Care to explain further about why you can't used key-based authentication? There are very few instances where it can't be made to work where scp works... – Paul Gear Nov 05 '13 at 22:18

1 Answers1

4

Try -t. From the ssh man page:

 -t      Force pseudo-tty allocation.  This can be used to execute arbi‐
         trary screen-based programs on a remote machine, which can be
         very useful, e.g. when implementing menu services.  Multiple -t
         options force tty allocation, even if ssh has no local tty.

What is probably happening is that scp is trying to read from the tty and failing because there isn't one.

Paul Gear
  • 4,367
  • 19
  • 38