Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

How to pass SSH flag -i for id_rsa #36

Closed
chetankatke opened this issue Apr 22, 2019 · 6 comments
Closed

How to pass SSH flag -i for id_rsa #36

chetankatke opened this issue Apr 22, 2019 · 6 comments

Comments

@chetankatke
Copy link

🤔

@gufastian
Copy link

Same for port.
Can't get it work :(

@kylejeske
Copy link

Take a look at Line31

and at Line111

sshCmdStr = fmt.Sprintf(
"ssh -tt -q -L %v %v %v 'cd %v; %v --host 127.0.0.1 --allow-http --no-auth --port=%v'", 
localPort + ":localhost:" + localPort, *sshFlags, host, dir, codeServerPath, localPort,
)

sshCmd = exec.Command("sh", "-c", sshCmdStr)

The whole thing just wraps SSH on the command line .. so based on the code above. The second %v allows for SSH parameters.

Using that .. it could look something like ..
Line 36

Usage: [-skipsync] %v HOST [DIR] [SSH ARGS...]
sshcode 10.0.1.10 ~/mydirectory '-i ~/.ssh/id_rsa'

@gufastian
Copy link

gufastian commented Apr 22, 2019

I tried passing parameters with quotes and without quotes, but the result is the same. Script tries to connect only to port 22.

MacBook:Downloads $ ./sshcode-darwin-amd64 [email protected] ~/projects '-p 1234'
2019-04-22 19:28:25 INFO ensuring code-server is updated...
ssh: connect to host xxx.xxx.com port 22: Operation timed out
2019-04-22 19:29:41 FATAL failed to update code-server: exit status 255

@SscSPs
Copy link
Contributor

SscSPs commented Apr 22, 2019

Currently, I don't think they are supported, but I think you can do all that by using ~/.ssh/config file to save your SSH targets

@ammario
Copy link
Member

ammario commented Apr 22, 2019

Sorry, the command's help is currently out-of-date with the flags. Going to fix that today in #37

sshcode --ssh-flags "-p 1234" [email protected] should work

@ammario
Copy link
Member

ammario commented Apr 22, 2019

Similarly, sshcode --ssh-flags '-i .ssh/id_rsa' [email protected] should work.

Feel free to re-open this issue if that's still not working for you.

@ammario ammario closed this as completed Apr 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants