2

I have remote red-hat 5.4 machine where I am able to execute

sudo lvdisplay

command locally using xyz user but while executing the same command remotely using xyz user through sshpass, I am getting the result as

sudo: lvdisplay: command not found.

The command I am executing is like

sshpass -p 'password' ssh -p 22 -o StrictHostKeyChecking=no xyz@hostname sudo lvdisplay

.

Please help me out to resolve the issue.

zapping
  • 4,118
  • 6
  • 38
  • 56
Anil More
  • 39
  • 1
  • 1
  • 6

1 Answers1

12
sshpass -p pass ssh -t user@192.168.XXX.XXX 'ls; bash -l'

Try the above command it worked for me. Remember to replace pass and user.

Wahyu Kristianto
  • 8,719
  • 6
  • 43
  • 68
SRIDHARAN
  • 1,196
  • 1
  • 15
  • 35