Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linux sshpass not able to execute command remotely [closed]

Tags:

sshpass

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.

like image 636
Anil More Avatar asked May 30 '26 12:05

Anil More


1 Answers

sshpass -p pass ssh -t [email protected] 'ls; bash -l'

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

like image 155
SRIDHARAN Avatar answered Jun 02 '26 02:06

SRIDHARAN