How use another port in ssh?
9Demien9 opened this issue · 8 comments
Hello!
You did a great thing! Thanks.
I turn to your example.
But I can't use an alternative ssh port.
Perhaps you can give an example of how to do this. If you do not specify the port, everything works.
Thank you in advance!
OK. I quoted the line calling ssh.exe from my Lua script.
local SSHEXEPATH=os.getenv("windir") .. [[\system32\OpenSSH\ssh.exe]]
local remoteid = arg[1]
spawnctx(SSHEXEPATH,
"-o","ServerAliveInterval=60",
"-N",
"-v",
"-o","PubkeyAcceptedKeyTypes=+ssh-dss",
"-p","27311",
"-L","13333:"..remoteip..":3389",
"hymkor@example.com")
Can it satisfy your needs ?
spawnctx
How do you call expect directly from lua?
spawnctx(NAME,ARG1,ARG2,...)
is a new built-in function available since v0.5.0
It is similar with spawn() but the process started by spawnctx is killed automatically when Ctrl-C is pressed.
To specify the port for ssh.exe , would you set the parameter as below to spawn() or spawnctx() ?
"-p","27311",
spawnctx(NAME,ARG1,ARG2,...)
is a new built-in function available since v0.5.0 It is similar with spawn() but the process started by spawnctx is killed automatically when Ctrl-C is pressed.To specify the port for ssh.exe , would you set the parameter as below to spawn() or spawnctx() ?
"-p","27311",
You don't quite understand me.
I am use expect as os.execute("expect.exe .....
How i can used expect directly in lua?
require "?"
There are no ways to import Expect.Lua on the pure lua interpreter.
Expect.Lua is a standalone application using Gopher-Lua engine.
It is not a library.
spawn
, spawnctx
and other extended functions are available only in the script executed on expect.exe.
There are no ways to import Expect.Lua on the pure lua interpreter.
Expect.Lua is a standalone application using Gopher-Lua engine. It is not a library.
spawn
,spawnctx
and other extended functions are available only in the script executed on expect.exe.
Are you include expect.exe in lua?! But how?!
The expect.exe contains the built-in Lua interpreter called as GopherLua that is the golang library.
You do not have to use require
statement.
You have to make your script using spawn
function and so on, and call it by expect.exe like expect.exe YOURSCRIPT.lua
.
Ожидаемый.exe содержит встроенный интерпретатор Lua, называемый GopherLua , который является библиотекой golang. Вам не нужно использовать
require
оператор. Вы должны сделать свой скрипт, используяspawn
функцию и т. д., и вызвать его с помощью expect.exe, напримерexpect.exe YOURSCRIPT.lua
.
Yes, thanks a lot, I figured it out. I originally used io.popen in lua, but it only works with os.execute.