i have two servers say server A and server B. i have a sudo user say user1 with full privilges on server A and B. i am trying to append the crontab entry of root from server A of server B with the following command. But its appending on A. i need to append it on server B.
please find the Command below which i am running on server A which should login to server B and append crontab entry of B. instead its appending on A only.
sshpass is extremely insecure, because the password is passed as a parameter. This gives an opportunity for it to be intercepted.
This is the reason for plain ssh's "annoying" limitation of only accepting passwords from a terminal, and why you had to install a third party utility to do this.
sudo has the same limitation - it will not accept a password from 'echo password'. su also has the same limitation, in fact, any sane authentication system will have the same limitation. Password authentication means typed-in-realtime-by-a-human authentication and no substitutions for human are acceptable.
I suggest using ssh keys for noninteractive authentication for ssh, and also suggest configuring sudo for passwordless operation so you don't have to kludge a password into it.
Don't do that. Backticks don't make sense there. But that command is not going to work, period -- sudo does not work that way.
I suggest using ssh keys for noninteractive authentication for ssh, and also suggest configuring sudo for passwordless operation so you don't have to kludge a password into it.
Once you do both of these, you will no longer need a third-party hacking utility to accomplish basic things. It's always easier when you use basic features as intended.