添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

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.
          
user@xxx:~$ ls -la /home/user/.ssh/id_rsa
-rw------- 1 user user 1679 Jan 18 14:03 /home/user/.ssh/id_rsa

I can not imagine it has something to do with server-side configuration since all my servers have this problem now. But then, still, I do not understand why it can not access this file.

[staging] > whoami
[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] < user
          

The weird thing is that I can see from the logs that it can establish the ssh connection. No deployer settings were changed between the time my deployments worked fine and now. Same goes for all my servers except one which I migrated to another hosting provider yesterday. I have not updated deployer, changed ssh-keys or whatsoever.

This is the error alert I get when executing a deployment:

[Deployer\Exception\RuntimeException (1)]                                                         
  The command "command -v 'git'" failed.                                                            
  Exit Code: 1 (General error)                                                                      
  Host Name: staging                                                                                
  ================                                                                                  
  Warning: Identity file /home/user/.ssh/id_rsa not accessible: No such file or directory. 
          

Can't tell why. Try to implement pseudo-deployer command. Try run this: https://gist.github.com/antonmedv/53181dce02a876872e74cb56c9090c62

But patch for you host, etc.

1:ssh -o ControlMaster=auto -o ControlPersist=60 -o ControlPath=~/.ssh/deployer_mux_*host* *host*  'bash -s'
1:run 'pwd'
1:/home/localosuser
1:command returned 0
2:ssh -O check -o ControlMaster=auto -o ControlPersist=60 -o ControlPath=~/.ssh/deployer_mux_*host*  *host* 2>&1
2:run ''
2:Master running (pid=29330)
2:command returned 0
          

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

olferuk, manongj, LarryWachira, Kerinlin, clarkshu1016, Coqueiro, ady642, adiatma85, tomoyk, lsw666-gif, and 5 more reacted with thumbs up emoji LarryWachira, eyeezzi, aiakovlev-gd, Coqueiro, ady642, lsw666-gif, and michaelpitop reacted with hooray emoji lsw666-gif reacted with heart emoji All reactions

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