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

Remote builder does not pass the username to SSHKit properly #603

Closed
hoblin opened this issue Dec 5, 2023 · 3 comments
Closed

Remote builder does not pass the username to SSHKit properly #603

hoblin opened this issue Dec 5, 2023 · 3 comments

Comments

@hoblin
Copy link

hoblin commented Dec 5, 2023

I have the following build config:

builder:
  remote:
    arch: arm64
    host: ssh://username@192.168.0.111
  cache:
    type: gha

When i run build it ignores the provided username and asks for a password for ubuntu user

  INFO [35c09382] Running /usr/bin/env true on 192.168.0.111
ubuntu@192.168.0.111's password:

I found that here username is passed as an option

def connect_to_remote_host(remote_host)
remote_uri = URI.parse(remote_host)
if remote_uri.scheme == "ssh"
options = { user: remote_uri.user, port: remote_uri.port }.compact
on(remote_uri.host, options) do
execute "true"
end
end
end

But it seems like SSHKit expects it as a part of the host name. I was able to connect successfully with the following change:

        on("#{remote_uri.user}@#{remote_uri.host}", options) do
@matharvard
Copy link
Contributor

I just ran into this issue as well. My remote builder uses the ubuntu user, but Kamal is attempting to connect to the server using root (I am guessing it's getting that user from the deployment configuration).

Here are the relevant bits of configuration files and logs.

# deploy.yml
builder:
  remote:
    arch: amd64
    host: ssh://ubuntu@remote-server
# Log files from the deploy command
  INFO [f4d6c663] Running /usr/bin/env true on remote-server
 DEBUG [f4d6c663] Command: /usr/bin/env true
Releasing the deploy lock...
  ERROR (Net::SSH::Disconnect): Exception while executing on host remote-server: disconnected: Too many authentication failures (2)
# auth.log on my remote server
Jan 12 19:47:22 remote-server sshd[3170]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Jan 12 19:47:22 remote-server sshd[3170]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Jan 12 19:47:22 remote-server sshd[3170]: error: maximum authentication attempts exceeded for root from 100.100.100.100 port 52000 ssh2 [preauth]
Jan 12 19:47:22 remote-server sshd[3170]: Disconnecting authenticating user root 100.100.100.100 port 52000: Too many authentication failures [preauth]

@SUMAR7
Copy link

SUMAR7 commented Feb 19, 2024

Any update on this, I'm having the same issue as well. Need to use ubuntu username instead of root

@Sija
Copy link
Contributor

Sija commented Feb 19, 2024

See #620

@djmb djmb closed this as completed May 21, 2024
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