Skip to content
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

SCP Password Prompt #8982

Closed
tmctl opened this issue Sep 11, 2018 · 6 comments
Closed

SCP Password Prompt #8982

tmctl opened this issue Sep 11, 2018 · 6 comments
Labels
environment user system environment (terminal, shell, tmux)

Comments

@tmctl
Copy link

tmctl commented Sep 11, 2018

  • nvim --version:
NVIM v0.3.1
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20180721-48604-1emkq4l/neovim-0.3.1/build/config -I/tmp/neovim-20180721-48604-1emkq4l/neovim-0.3.1/src -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim-20180721-48604-1emkq4l/neovim-0.3.1/build/src/nvim/auto -I/tmp/neovim-20180721-48604-1emkq4l/neovim-0.3.1/build/include
Compiled by [email protected]

Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.3.1/share/nvim"
  • Vim (version: ) behaves differently?
    yes - prompts for a password (vim 8.1)
  • Operating system/version:
    macOS 10.13.6
  • Terminal name/version:
    iterm 3.2.0 and Terminal 2.8.2
  • $TERM:
    xterm-256color

Steps to reproduce using nvim -u NORC

nvim -u NORC
:scp 'user@host:/path/to/file' '/path/to/file'

or

nvim scp://user@host//path

Actual behaviour

3 permission denied responses

Expected behaviour

a prompt for the password

@tmctl
Copy link
Author

tmctl commented Sep 12, 2018

@justinmk thank you. is there a best practice to opening a file over the network that is going to challenge for a password? :e scp://user@host//path or do I just need to not use this functionality in this use case?

@jamessan
Copy link
Member

Use an ssh-agent with a GUI prompt and/or key-based authentication.

@sktrinh12
Copy link

hi, was there a solution to this? or nvim is incapable of doing remote editing? I am encountering the same issue. I tried reading that link provided but I don't understand it.

@tmctl
Copy link
Author

tmctl commented Jan 11, 2020

hi, was there a solution to this? or nvim is incapable of doing remote editing? I am encountering the same issue. I tried reading that link provided but I don't understand it.

The answer was basically that it's not supported.

@justinmk justinmk added the environment user system environment (terminal, shell, tmux) label Jan 11, 2020
@camAtGitHub
Copy link

For nvim to work without password prompts you need to enable the ssh feature of multiplexing.
Edit your ~/.ssh/config file (or create it) and add at the bottom of the file:

Host *
#   User your-generic-username-here
    ControlPath ~/.ssh/%C
    ControlMaster auto
    ControlPersist 15s

Now ssh to the server in question in a different terminal/windows etc
Now in the original terminal/window type: nvim scp://[email protected]//tmp/foo and Voilà !
I recommend using scp instead of sftp, in my limited testing, sftp fails silently if the write failed (ie. due to permissions).
Also notice the double slash before tmp, yes thats needed.

Additional benefits of mutliplexing are:

  • ssh to the server again... no password prompt.
  • Tab expansion on files & paths when using sftp & scp on the cli.
  • Other secret stuff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
environment user system environment (terminal, shell, tmux)
Projects
None yet
Development

No branches or pull requests

5 participants