teambition / gulp-ssh

SSH and SFTP tasks for gulp
184 stars 38 forks source link

Can not find ssh_id file using ~/ prefix #53

Closed lcrodriguez closed 6 years ago

lcrodriguez commented 8 years ago

I have a problem with this because it's not reading the key file using ~/.ssh/ssh_id.pub shortcut. It's says the file does not exist but of course it does. I have to put the real path to work, which is /User/leo/.ssh/ssh_id.pub but does it very specific to my machine. Any workarounds to this? I want any user with permissions to be able to deploy to the server.

VuongN commented 6 years ago

You could do it this way:

var fs = require('fs'),
      os = require('os'),
      path = require('path'),
      privKey = fs.readFileSync(path.join(os.homedir(), '.ssh/id_rsa'));
mojavelinux commented 6 years ago

This library does not work directly with the private key path. It only works with the private key data. It's up to you to resolve and read the file. Therefore, I think this issue can be closed.

But I do think that this library should accept a privateKey path, which is what #68 is about. Then we could interpret the ~.