标签:远程服务器 cond log -- 主机 echo https targe 远程主机
[root@vps ~]# ssh user@192.168.9.243 "pwd; ls; rm -f Cent* ;echo --------; ls"
/home/user
anaconda-ks.cfg
Centos7.img
mwgt.tar.gz
--------
anaconda-ks.cfg
mwgt.tar.gz
[root@vps ~]#
[root@vps ~]# cat ssh.sh pwd ls touch BBBB ls
ls /root [root@vps ~]# ssh user@192.168.9.243 < ssh.sh Pseudo-terminal will not be allocated because stdin is not a terminal. /home/user anaconda-ks.cfg mwgt.tar.gz anaconda-ks.cfg BBBB mwgt.tar.gz
ls: cannot open directory /root: Permission denied
[root@vps ~]# ssh user@192.168.9.243 sudo bash -s < ssh.sh
/home/user
anaconda-ks.cfg
mwgt.tar.gz
anaconda-ks.cfg
BBBB
mwgt.tar.gz
anaconda-ks.cfg
[root@vps ~]#
[root@vps ~]# cat ssh.sh echo $0 echo $1 echo $# [root@vps ~]# ssh user@192.168.9.243 ‘bash -s‘ < ssh.sh vps1 bash: vps1: command not found [root@vps ~]# ssh user@vps1 ‘bash -s‘< ssh.sh vps1 bash vps1 1 [root@vps ~]#
PS:
[linux] ssh远程执行本地脚本 带参数的ssh传递
标签:远程服务器 cond log -- 主机 echo https targe 远程主机
原文地址:https://www.cnblogs.com/firewalld/p/12167294.html