Variables 如何使用apple脚本进行ssh连接?
我正在开发一个简单的apple脚本来帮助日常ssh连接 这里有一个例子Variables 如何使用apple脚本进行ssh连接?,variables,ssh,applescript,Variables,Ssh,Applescript,我正在开发一个简单的apple脚本来帮助日常ssh连接 这里有一个例子 tell application "Terminal" set ServerName to "IP" set ServerUserName to "user" set ServerPassword to "password" end tell 现在,我有点怀疑 我怎么做sshusername@servername并发送我的密码 是这样的吗 do shell script "ssh " & S
tell application "Terminal"
set ServerName to "IP"
set ServerUserName to "user"
set ServerPassword to "password"
end tell
现在,我有点怀疑
我怎么做sshusername@servername
并发送我的密码
是这样的吗
do shell script "ssh " & ServerUserName & " @ " & ServerAddress
dealy 5
keystroke ServerPassword
谢谢虽然您不应该使用@Jakuje提到的硬编码密码,但您可以使用以下方法:
tell application "Terminal"
set ServerAddress to "IP"
set ServerUserName to "user"
set ServerPassword to "pw"
end tell
tell application "Terminal"
set currentTab to do script ("ssh " & ServerUserName & "@" & ServerAddress & ";")
delay 5
do script (ServerPassword) in currentTab
end tell
这对您有帮助吗?虽然您不应该使用@Jakuje提到的硬编码密码,但您可以使用以下方法:
tell application "Terminal"
set ServerAddress to "IP"
set ServerUserName to "user"
set ServerPassword to "pw"
end tell
tell application "Terminal"
set currentTab to do script ("ssh " & ServerUserName & "@" & ServerAddress & ";")
delay 5
do script (ServerPassword) in currentTab
end tell
这对您有帮助吗?设置公钥身份验证。不要硬编码密码。这不是一个好的做法。请设置公钥身份验证。不要硬编码密码。这不是一个好的做法。