question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught Error: Encrypted private key detected, but no passphrase given

See original GitHub issue

[Enter steps to reproduce below:]

  1. Providing host, user, remote(dir?) and path to agent (/usr/bin/ssh-agent),and path to private key
  2. Click on Connect.

As I have configured the ssh-agent, it really does not make sense that I have to provide a passphrase for the agent here, as the agent is active and has been logged in with a passphrase. I really should not provide an unencoded passphrase in the config file.

Atom Version: 1.0.2 System: Mac OS X 10.10.3 Thrown From: Remote-FTP package, v0.7.1

Stack Trace

Uncaught Error: Encrypted private key detected, but no passphrase given

At /Users/klay6683/.atom/packages/Remote-FTP/node_modules/ssh2/lib/client.js:152

Error: Encrypted private key detected, but no passphrase given
  at Client.connect (/Users/klay6683/.atom/packages/Remote-FTP/node_modules/ssh2/lib/client.js:152:15)
  at ConnectorSFTP.module.exports.ConnectorSFTP.connect (/Users/klay6683/.atom/packages/Remote-FTP/lib/connectors/sftp.js:78:13)
  at Client.module.exports.Client.connect (/Users/klay6683/.atom/packages/Remote-FTP/lib/client.js:198:18)
  at Client.<anonymous> (/Users/klay6683/.atom/packages/Remote-FTP/lib/views/tree-view.js:178:28)
  at /Users/klay6683/.atom/packages/Remote-FTP/lib/client.js:87:14
  at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:379:3)

Commands

     -7:26.4.0 core:move-down (atom-text-editor.editor.is-focused)
  3x -7:26.2.0 core:move-right (atom-text-editor.editor.is-focused)
     -7:24.6.0 core:backspace (atom-text-editor.editor.is-focused)
     -7:18.9.0 core:move-down (atom-text-editor.editor.is-focused)
     -7:18.2.0 core:save (atom-text-editor.editor.is-focused)
     -7:08.4.0 remote-ftp:connect (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
     -2:41.1.0 core:move-right (atom-text-editor.editor.is-focused)
  2x -2:39.5.0 core:backspace (atom-text-editor.editor.is-focused)
     -2:34.9.0 core:save (atom-text-editor.editor.is-focused)
     -1:48.8.0 core:backspace (atom-text-editor.editor.is-focused)
     -1:45.2.0 core:save (atom-text-editor.editor.is-focused)
     -1:19.5.0 core:backspace (atom-text-editor.editor.is-focused)
     -1:13.1.0 core:save (atom-text-editor.editor.is-focused)
  9x -0:27.6.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:25.8.0 core:save (atom-text-editor.editor.is-focused)
  6x -0:09.9.0 core:backspace (atom-text-editor.editor.is-focused)

Config

{
  "core": {}
}

Installed Packages

# User
Remote-FTP, v0.7.1
atom-beautify, v0.28.7
autocomplete-python, v0.5.1
color-picker, v2.0.10
git-diff-details, v0.18.0
git-log, v0.4.1
language-gitignore, v0.2.0
linter-flake8, v1.5.0
minimap, v4.11.2
minimap-git-diff, v4.1.7
my-github-profile, v0.2.1
project-manager, v1.15.11
remote-atom, v1.2.6
tab-numbers, v0.2.0
travis-ci-status, v0.16.0
tree-view-git-modified, v0.5.10
tree-view-git-status, v0.1.1

# Dev
No dev packages

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:10

github_iconTop GitHub Comments

6reactions
adamfrancocommented, Nov 13, 2015

Ok, so poking at this a bit more, it seems that @jpxd 's comment about the empty path for the privatekey option and the "agent": "env" tip #99 together allow the OSX ssh-agent to work. I’ve now gotten remote-ftp connecting to a remote host reliably using my encrypted private key and ssh-agent preventing the need for me to enter my password every single save with the following .ftpconfig:

{
    "protocol": "sftp",
    "host": "hostname.domain.edu",
    "port": 22,
    "user": "username",
    "pass": "",
    "promptForPass": false,
    "remote": "/home/username/path/to/project",
    "agent": "env",
    "privatekey": "",
    "passphrase": "",
    "hosthash": "",
    "ignorehost": true,
    "connTimeout": 10000,
    "keepalive": 10000,
    "keyboardInteractive": false
}

The one outstanding issue I’ve had with this configuration is that remote-ftp fails with the following message rather than prompting for my ssh-key pass-phrase if the key is new or I haven’t stored the ssh-key’s passphrase in the OSX Keychain: remote-ftp-failure The solution to this is easy: Open a terminal and run ssh hostname.domain.edu to have the terminal prompt for the pass-phrase and add the key to the running ssh-agent, but having Atom initiate the prompt would be more clear.

0reactions
kr4utcommented, Aug 11, 2018

For reference to open source lovers the workaround from @adamfranco also works on GNU/Linux 👍 Just tested it with Ubuntu 18.04 for evaluating Atom and the ssh-agent integration works with the graphical GNOME popup on first unlock of the private key. But it seems not to work with referencing the host entries from ~/.ssh/config and unfortunately only with configuring it fully like this:

{
    "protocol": "sftp",
    "host": "******",
    "port": 22,
    "user": "******",
    "pass": "",
    "promptForPass": false,
    "remote": "/home/******",
    "agent": "env",
    "privatekey": "",
    "passphrase": "",
    "hosthash": "",
    "ignorehost": true,
    "connTimeout": 10000,
    "keepalive": 10000,
    "keyboardInteractive": false
}

But this is still just a workaround and probably won’t work when using multiple private keys (neither via ~/.ssh/config nor .ftpconfig)!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Encrypted private key detected, but no passphrase ...
When using the following code and using a passphrase protected key, I get the error: Error: Encrypted private key detected, but no ......
Read more >
Encrypted private key detected, but no passphrase given - help
I can ssh to my server from the terminal, I am not asked for password or passphrase. But the command mup setup throws...
Read more >
Encrypted private key detected, but no passphrase given
Uncaught Error : Encrypted private key detected, but no passphrase given.
Read more >
How to use an encrypted private key with golang ssh
ParsePrivateKey(key) . I've modified the decrypt function to decrypt and encode the private key, if it is encrypted, and return it, so that...
Read more >
[VS2017] Can't connect to mac : Private key is encrypted but ...
This error is coming from the decryption attempt that we do, to decrypt the passphrase content. We are encrypting/decrypting with the Data Protection...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found