远程通过SSH执行linux服务器命令
大家应该遇到过需要在远程linux服务器上执行命令的情况,但是ssh都是需要输入密码的(做互信的除外),如何能够在不需要交互的情况下执行命令呢?下面给大家提供一个小工具,无需配置即可使用,如果大家觉得好用,请默默给我点赞。
本工具为在windows 和 linux 主机上远程执行 linux 服务器命令
使用格式如下:
1、windows
ssh_exec.exe [ip] [port] [username] [password] [command1;command2;command...]
2、linux
①使用前使用【chmod +x ssh_exec 】添加执行权限
②执行如下命令
./ssh_exec [ip] [port] [username] [password] [command1;command2;command...]
3、说明:
ip --远程执行服务器IP地址,IP类型
port --远程执行服务器端口号,数字类型
username --远程执行服务器登陆执行用户,字符串
password --远程执行服务器登陆执行用户的密码,字符串
command --需要远程执行的命令,使用双引号(“”)包裹,多条命令使用使用“;”隔开,字符串
4、例如,以windows为例:
ssh_exec.exe 127.0.0.1 22 testuser userpwd "pwd" --执行单条命令
ssh_exec.exe 127.0.0.1 22 testuser userpwd "cd home;pwd;..." --执行多条命令
下载地址 提取码:r50o