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

No such file or directory: '/home/stanley/.ssh/stanley_rsa #6116

Open
doing-cr7 opened this issue Jan 22, 2024 · 6 comments
Open

No such file or directory: '/home/stanley/.ssh/stanley_rsa #6116

doing-cr7 opened this issue Jan 22, 2024 · 6 comments

Comments

@doing-cr7
Copy link

i got a error when i run core.remote

st2 run core.remote hosts='10.69.10.1:5000' cmd='echo123'
.
id: 65ae14e509204db1549f4a31
action.ref: core.remote
context.user: st2admin
parameters:
  cmd: echo123
  hosts: 10.69.10.1:5000
status: failed
start_timestamp: Mon, 22 Jan 2024 07:10:29 UTC
end_timestamp: Mon, 22 Jan 2024 07:10:29 UTC
result:
  error: "Unable to connect to any one of the hosts: ['10.69.10.1:5000'].

 connect_errors={
  "10.69.10.1": {
    "failed": true,
    "succeeded": false,
    "timeout": false,
    "return_code": 255,
    "stdout": "",
    "stderr": "",
    "error": "Failed connecting to host 10.69.10.1. [Errno 2] No such file or directory: '/home/stanley/.ssh/stanley_rsa'",
    "traceback": "Traceback (most recent call last):\
  File \\"/opt/stackstorm/st2/lib/python3.8/site-packages/st2common/runners/parallel_ssh.py\\", line 278, in _connect\
    client.connect()\
  File \\"/opt/stackstorm/st2/lib/python3.8/site-packages/st2common/runners/paramiko_ssh.py\\", line 171, in connect\
    self.client = self._connect(host=self.hostname, socket=self.bastion_socket)\
  File \\"/opt/stackstorm/st2/lib/python3.8/site-packages/st2common/runners/paramiko_ssh.py\\", line 747, in _connect\
    passphrase_reqd = self._is_key_file_needs_passphrase(self.key_files)\
  File \\"/opt/stackstorm/st2/lib/python3.8/site-packages/st2common/runners/paramiko_ssh.py\\", line 841, in _is_key_file_needs_passphrase\
    cls.from_private_key_file(file, password=None)\
  File \\"/opt/stackstorm/st2/lib/python3.8/site-packages/paramiko/pkey.py\\", line 249, in from_private_key_file\
    key = cls(filename=filename, password=password)\
  File \\"/opt/stackstorm/st2/lib/python3.8/site-packages/paramiko/rsakey.py\\", line 64, in __init__\
    self._from_private_key_file(filename, password)\
  File \\"/opt/stackstorm/st2/lib/python3.8/site-packages/paramiko/rsakey.py\\", line 190, in _from_private_key_file\
    data = self._read_private_key_file(\\"RSA\\", filename, password)\
  File \\"/opt/stackstorm/st2/lib/python3.8/site-packages/paramiko/pkey.py\\", line 321, in _read_private_key_file\
    with open(filename, \\"r\\") as f:\
FileNotFoundError: [Errno 2] No such file or directory: '/home/stanley/.ssh/stanley_rsa'\
"
  }
}"
  traceback: "  File "/opt/stackstorm/st2/lib/python3.8/site-packages/st2actions/container/base.py", line 117, in _do_run
    runner.pre_run()
  File "/opt/stackstorm/st2/lib/python3.8/site-packages/st2common/runners/paramiko_ssh_runner.py", line 206, in pre_run
    self._parallel_ssh_client = ParallelSSHClient(**client_kwargs)
  File "/opt/stackstorm/st2/lib/python3.8/site-packages/st2common/runners/parallel_ssh.py", line 90, in __init__
    connect_results = self.connect(raise_on_any_error=raise_on_any_error)
  File "/opt/stackstorm/st2/lib/python3.8/site-packages/st2common/runners/parallel_ssh.py", line 131, in connect
    raise NoHostsConnectedToException(msg)

but i only exec ssh command is ok

ssh 10.69.10.1 -p 5000

i try

cp ~/.ssh/id_rsa  /home/stanley/.ssh/stanley_rsa

again run

st2 run core.remote hosts='10.69.10.1:5000' cmd='echo123'

error don't resolved

@mamercad
Copy link
Contributor

Does the user account that is running the StackStorm processes have right to read the key?

@garadar
Copy link

garadar commented May 6, 2024

I have the same error, if you are using a different home than /home/stanley:

getent passwd stanley
stanley:x:900:900::/opt/xxxx/xxx/home/stanley:/bin/bash

but core.remote using remote-shell-cmd by default take a bad value. You can overwritte it using private_key= option or setting a symlink in /home to the home.

@garadar
Copy link

garadar commented May 6, 2024

OMHO, stackstorm should read the $HOME of stanley instead /home/stanley by default

@mamercad
Copy link
Contributor

mamercad commented May 6, 2024

OMHO, stackstorm should read the $HOME of stanley instead /home/stanley by default

I wonder if this would help.

@garadar
Copy link

garadar commented May 7, 2024

indeed it could; I will try Thx

@garadar
Copy link

garadar commented May 17, 2024

It's 'working' However, the one line command does not work if you create the stanley user with a custom home before the install.

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

3 participants