Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell 我可以在unix脚本中调用ssh中的函数吗_Shell_Ssh_Ksh - Fatal编程技术网

Shell 我可以在unix脚本中调用ssh中的函数吗

Shell 我可以在unix脚本中调用ssh中的函数吗,shell,ssh,ksh,Shell,Ssh,Ksh,我试图登录到远程服务器,我想在远程服务器上执行该功能。我可以发送ssh命令中包含的函数名。当然可以。下面是它的适当语法。可以运行一个或多个以分号分隔的命令 ssh -n -l yourusername yourremoteserver "pwd; hostname; netstat -tupln | tail -5" 让我知道这是否适合你 注意-请注意,in将询问您的密码。如果您计划在脚本中使用此功能,则应将密钥复制到您尝试在其上运行命令的远程服务器,只有这样,它才会使用密钥进行身份验证,而不

我试图登录到远程服务器,我想在远程服务器上执行该功能。我可以发送ssh命令中包含的函数名。

当然可以。下面是它的适当语法。可以运行一个或多个以分号分隔的命令

ssh -n -l yourusername yourremoteserver "pwd; hostname; netstat -tupln | tail -5"
让我知道这是否适合你

注意-请注意,in将询问您的密码。如果您计划在脚本中使用此功能,则应将密钥复制到您尝试在其上运行命令的远程服务器,只有这样,它才会使用密钥进行身份验证,而不是提示输入密码。复制同样是一个简单的过程,非常简单,您可以在这里看到以下步骤:


您的意思是登录后会执行一个函数?什么功能?