admin管理员组文章数量:1572326
refs:
http://stackoverflow/questions/5162568/linux-execute-command-remotely
http://serverfault/questions/241588/how-to-automate-ssh-login-with-password
http://stackoverflow/questions/12202587/automatically-enter-ssh-password-with-script
http://stackoverflow/questions/19996089/use-ssh-to-start-a-background-process-on-a-remote-server-and-exit-session
ssh -OPTIONS -p SSH_PORT user@remote_server "remote_command1; remote_command2; remote_script.sh"
ssh user@machine 'bash -s' < local_script.sh
or you can just
ssh user@machine "remote command to run"
ssh自动输入密码
First you need to install sshpass.
Ubuntu/Debian: apt-get install sshpass
Fedora/CentOS: yum install sshpass
Arch: pacman -S sshpass
SSHPASS EXAMPLE:
sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no YOUR_USERNAME@SOME_SITE.COM
SSHPASS CUSTOM PORT EXAMPLE:
sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no YOUR_USERNAME@SOME_SITE.COM:2400
ssh 执行远程指令后不会立刻返回,可用 -f 来实现。
The "-f" option to ssh tells ssh to run the remote command in the background and to return immediately. E.g.,
ssh -f user@host "echo foo; sleep 5; echo bar"
If you type the above, you will get your shell prompt back immediately, you will then see "foo" output. Five seconds later you will then see "bar" output. In the meantime, you could have been using the shell.
无效?
版权声明:本文标题:remote deploy orremote executive 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1727724545a1127066.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论