0

I have a redis database on a remote docker host, and I'd like to access it through a single ssh script command via plink.

The script is simple (redis-script.sh):

#!/bin/bash
echo "Enter Redis Password."
read -s pass
docker exec -it my-redis-container redis-cli -a $pass

Which works fine when I do a standard ssh connection via putty then run the script after login. I am able to enter the password and connect to the db:

Enter Redis Password.
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379>

The problem is when I use plink, my plink command line:

plink.exe -t container-host /containers/redis-script.sh

I get this:

Enter Redis Password.
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
[6n

One issue is the mangled characters, but the biggest issue is that I can no longer type in any commands at this point. I am able to interact when it asks for the password, but once it gets into redis-cli, I cannot type anything.

Perhaps it's the docker exec command which is messing up the interactivity?

Any help is appreciated.

R. StackUser
  • 2,005
  • 4
  • 17
  • 24
  • Plink is not really intended for an interactive use. Why don't you use the PuTTY? – Martin Prikryl Sep 21 '19 at 15:14
  • I am currently using putty, thanks. I initially wanted to use plink to keep in the same terminal and be able to run inline commands rather than putty's "-m " command, but this will work well enough. – R. StackUser Sep 23 '19 at 17:06

0 Answers0