0

My requirement : i want to pass some commands with sshpass command. ex 1:

sshpass -p 'sshpass' ssh -oKexAlgorithms******* user@host touch /mnt/us/pass

above sshpass example works perfectly.

ex 2:

sshpass -p 'sshpass' ssh -oKexAlgorithms******* user@host mntroot rw

in above example, in host i have to give mntroot rw to enable read write permission for the logged user. this command not works when i pass with sshpass command and it throws sh: mntroot: not found error but it works perfectly in host when i logged in and entered it manually.

please help me on this.

1
  • 1
    Does it work with the full path of mntroot? May 13, 2018 at 15:22

1 Answer 1

0

One solution is to call mntroot with the full path.

Interactive shells and non-interactive shells use different initialization files. That may be the reason. When you log in to the system you obviously have a different PATH value.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .