简体   繁体   中英

How to auto login ssh server and run some command to modify a file

Here is the limitations:

  1. No public key file uploaded to server (since this may be run at different target machine), this is just for an automatic testing program, so security is not a concern.
  2. It's automatically program run background, so no user input.
  3. I do not want to use "expect" which require user to install.
  4. I have know the root user's password.

So I wonder is that a lightweight expect tool or a ssh library I can easily use to do such work.

libssh http://www.libssh.org/ can help for a C project. Using Perl, there is a module which can be used: Net::SSH (I use it for +/- the same kind of purposes)

唯一正确的安全方法是使用导出的SSH公钥文件,每个客户端和每台服务器均已通过验证,否则,阻止哈巴巴迪先生利用该系统的措施是什么?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM