Error: creating custom disk: unable to authenticate user over SSH #2120
-
Hello! When authenticating using the API token, I get the error:
When I authenticate with the same API token in the telmate/proxmox provider, the virtual machine is created without errors. The API token has been granted all necessary access permissions (administrator privileges). SSH keys for the user 'opentofu' have been generated and added to the file /etc/pve/priv/authorized_keys. The user 'opentofu' has been granted administrator privileges. If I authenticate using the username and password of the 'opentofu' user, the virtual machine is created without errors. What's wrong?
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hey @testdcpractice! 👋🏼 Since you don't have However, if you're running PVE 8.4+, you can change your config to use |
Beta Was this translation helpful? Give feedback.
-
I solved the issue. The SSH block should look like this. provider "proxmox" { ssh {
} I still couldn't create a virtual machine with the "opentofu" API token — only with the "root" API token(I didn’t update Proxmox to version 8.4+ — I’m using 8.3.3.). In fact, there's no point in creating a second "opentofu" user. For the block resource "proxmox_virtual_environment_download_file" "rocky_cloud_image" to work for the "opentofu" user, they must have the same privileges as "root" (and why create a second root when one already exists?) |
Beta Was this translation helpful? Give feedback.
-
I solved the issue. You need to create the authorized_keys file in the user's directory /home/opentofu/.ssh on the Proxmox server and copy the user's public SSH key into it. This should be done on each node. My mistake was that I copied the public SSH keys of the opentofu user into the /etc/pve/priv/authorized_keys file – I thought this file was shared, but it is only for the root user. provider "proxmox" { ssh {
} |
Beta Was this translation helpful? Give feedback.
I solved the issue. You need to create the authorized_keys file in the user's directory /home/opentofu/.ssh on the Proxmox server and copy the user's public SSH key into it. This should be done on each node. My mistake was that I copied the public SSH keys of the opentofu user into the /etc/pve/priv/authorized_keys file – I thought this file was shared, but it is only for the root user.
provider "proxmox" {
endpoint = var.api_url
#username = var.pm_user
#password = var.pm_password
api_token = "opentofu@pam!provider=secret-opentofu-token"
insecure = true // necessary because of self-signed certificates
ssh {
agent = true
username = "opentofu"
}
}