deployer: Warning: Identity file id_rsa not accessible: No such file or directory.

Q A
Issue Type Question
Deployer Version 6.0.3
Local Machine OS Ubuntu 16.04
Remote Machine OS Ubuntu 16.04

Description

Somehow my deployer setup is broken. I get the follow warning in all commands involving establishing a ssh-connection with one of my servers. It doesn’t matter which server I’m deploying to, this message pops up everywhere in the logs.

Warning: Identity file /home/user/.ssh/id_rsa not accessible

Using the following command I’m log in perfectly fine into my servers:

ssh user@xxx

On a side-note: I’m using Docker for running PHP.

Steps to reproduce

I really have no clue.

Content of hosts.yml

.deploy-template: &deploy-template
    ssh_type: native
    ssh_multiplexing: true

    user: xxx
    port: 22
    identityFile: /home/user/.ssh/id_rsa

staging:
  <<: *deploy-template
  hostname: xxx
  stage: staging
  deploy_path: /var/www/staging

Output log

[localhost] > git rev-parse --abbrev-ref HEAD
[localhost] < master
✈︎ Deploying master on xxx
• done on [staging]
➤ Executing task deploy:prepare
[staging] > echo $0
[staging] < ssh multiplexing initialization
[staging] < Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-109-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

[staging] < Warning: Identity file /home/user/.ssh/id_rsa not accessible: No such file or directory.
[staging] < bash
[staging] > if [ ! -d /var/www/staging ]; then mkdir -p /var/www/staging; fi
[staging] < Warning: Identity file /home/user/.ssh/id_rsa not accessible: No such file or directory.
[staging] > if [ ! -L /var/www/staging/current ] && [ -d /var/www/staging/current ]; then echo 'true'; fi
[staging] < Warning: Identity file /home/user/.ssh/id_rsa not accessible: No such file or directory.
[staging] > cd /var/www/staging && if [ ! -d .dep ]; then mkdir .dep; fi
[staging] < Warning: Identity file /home/user/.ssh/id_rsa not accessible: No such file or directory.
[staging] > cd /var/www/staging && if [ ! -d releases ]; then mkdir releases; fi
[staging] < Warning: Identity file /home/user/.ssh/id_rsa not accessible: No such file or directory.
[staging] > cd /var/www/staging && if [ ! -d shared ]; then mkdir shared; fi
[staging] < Warning: Identity file /home/user/.ssh/id_rsa not accessible: No such file or directory.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (13 by maintainers)

Most upvoted comments

I have faced same issue when transferring file.

ssh -i ~/.ssh/key.pem source_dir destination_dir ssh -i $HOME/.ssh/key.pem source_dir destination_dir

I changed “~” to “$HOME” and it worked perfectly.

Thanks

FTR in some cases, it’s not the path to the key but the presence of quotes that causes a problem: ssh -i "path/to/key.pem" user@public_hostname -> no such file error ssh -i path/to/key/pem user@public_hostname -> OK

Not sure if it’s the same on Windows, but you can also escape spaces instead: C:/Users/User\ name/filename.pem

What if the path contains a space, in that we have to use quotes. Instead of C:/Users/Username/filename.pem, we have this C:/Users/User name/filename.pem. In the later case the quotes are must.

Sadly, turning multiplexing off doesn’t fix it either.

Just upgraded to v6.0.5. No luck.

I will be looking further into this tomorrow. I’ll keep you posted. Thanks for the help so far! Greatly appreciated.

Indeed, this is really strange behavior. Will be cool to try to run ssh comand what deployer runs exactly. But It’s difficult, need to put echo in deployer (Will do it by default for -vvv in v7).