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

Tilde expansion fails for ssh key value #18

Open
mehulved opened this issue Sep 23, 2013 · 6 comments
Open

Tilde expansion fails for ssh key value #18

mehulved opened this issue Sep 23, 2013 · 6 comments

Comments

@mehulved
Copy link

I tried using tilde for my ssh key path. But that fails to find the key. I ensured that the path was correct. But, when I replaced the tilde with user homedir path, it worked fine.
Is the tilde expansion disabled or does it expand to root path? I did execute the script as own user. And there's the ssh key in that user's path.

@mehulved
Copy link
Author

What doesn't work

$ deploy development setup
Warning: Identity file ~/.ssh/id_dsa.pub not accessible: No such file or directory.
$ cat deploy.conf 
[development]
key ~/.ssh/id_dsa.pub
user mehul

What works

$ cat deploy.conf 
[development]
key /home/mehul/.ssh/id_dsa.pub
user mehul
$ deploy development setup
Enter passphrase for key '/home/mehul/.ssh/id_dsa.pub': 

@jmervine
Copy link

I see this issue over and over again, when script ssh commands. I'd love to hear an explanation why. Simple avoidance is to replace '~' with "$HOME" when parsing configuration.

@hovsater
Copy link

hovsater commented Nov 3, 2013

This is how bash works. As soon as a tilde has been quoted, i.e., '~', it will not be expanded. Usually one bypasses this by using $HOME instead.

One can expand tilde by using eval, but usually one want to avoid this. See http://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html for more information.

@micky2be
Copy link

Is there a solution for that? Both ~ and $HOME are not working

@micky2be
Copy link

Nothing?

@2hu12
Copy link

2hu12 commented Apr 6, 2016

@micky2be I created a pull request of pm2-deploy to solve the same problem, if you're interested. Unitech/pm2-deploy#81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants