-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Cannot find known_hosts file if username has whitespace on windows #162
Comments
@ysl2 this is actually an issue with the ssh library we use, wezterm-ssh. You could try changing the backend from ssh2 to libssh and see if that fixes your problem. Otherwise we'd need a fix in wezterm-ssh! 😄 |
I solved this but with a llittle flaw. distant/src/cli/commands/manager/handlers.rs Line 435 in 27dc577
distant/src/cli/commands/manager/handlers.rs Line 412 in 27dc577
I commented this line below, and directly inject a lua table contains settings into the Also I linked my
This is the minimal nvim init.lua config: -- NOTE: An example of local variable `hosts` defined by myself, it contains hosts information.
-- local hosts = {
-- {
-- args = { 'ssh://user1@111.222.333.444:22' },
-- opts = {
-- options = {
-- -- ['ssh.backend'] = 'libssh', -- No need to specify this. Just for example.
-- ['ssh.user_known_hosts_files'] = 'C:\\Users\\Public\\.ssh\\known_hosts',
-- ['ssh.identity_files'] = 'C:\\Users\\Public\\.ssh\\id_rsa'
-- }
-- }
-- },
-- {
-- args = { 'ssh://user2@127.0.0.1:2233' },
-- opts = {} -- Or leave it empty on Linux.
-- }
-- }
function DistantConnect(idx)
require('distant.command').connect(hosts[idx])
end
function DistantOpen(path)
require('distant.command').open({ args = { path }, opts = {} })
end
vim.keymap.set('n', '<Leader>dc', ':lua DistantConnect()<Left>')
vim.keymap.set('n', '<Leader>do', ":lua DistantOpen('')<Left><Left>") It can work now with flaw, beacuse I exposed my private I don't think this is an elegant way to solve the problem, but it really can work on windows, espacially when the path contains whitespace. I won't set a whitespace username next time if I have a new computer or after reinstalling windows system, beacuse it's too annoying. |
Hm, this could be an issue at some point when CLI arguments are passed around, but I'm not sure at what point in the codebase it happens. Will leave this as a bug to solve at some point for the distant binary, to be revisited when I have a little more time to dig in. Thanks for the detailed report and glad you found a workaround for the time being! |
My known_hosts file locates in
C:\Users\fa fa\.ssh\known_hosts
. There is a whitespace on path (fa fa
). I have modified yourdistant.nvim
source code to fix this problem, so thedistant.nvim
plugin can work normally on my machine. But finally I traced that the plugin called thedistant.exe
package then the bug occured. I have no idea how to modify rust code format. Need help please :-) thanks a lot!Click here to check git diff for
distant.nvim
Bug occured below after running
:DistantLaunch ssh://myname@example_host:22<CR>
The text was updated successfully, but these errors were encountered: