Mender-Artifact SSH Connection with IdentityFile

Hey there,
hopefully someone can give me advice how to use the --ssh-args option when creating a Mender artifact from an golden image.

So I want to create a golden image from a remote device via SSH and using mender-artifact for this. The device SSH remote connection can just be established via an SSH Keyfile which works fine during default SSH connection and the -i PATH_TO_IDENTITYFILE parameter, for example:

For mender-artifact I need to set the Identity File by the --ssh-args="-o IdentityFile=PATH_TO_IDENTITY_FILE parameter but this won’t work because mender-artifact says that the key file doesn’t exist.
Also adding an additional option IdentitiesOnly=yes shows the same error.

Can you help me by enterring a complete command for SSH remote connection via SSH Keyfile?

Complete command with output:
mender-artifact write rootfs-image -f ssh://USER@IPv4 -n NAME --software-version SOFTWARE_VERSION -o file.mender -t TYPE --ssh-args="-o IdentityFile=PATH_TO_IDENTITY_FILE" --ssh-args="-o IdentitiesOnly=yes" no such identity: PATH_TO_IDENTITY_FILE: No such file or directory USER@IPv4: Permission denied (publickey). SSH error: Error waiting for ssh session to be established.: EOF


Hello Andreas,

thank you for using Mender.
I have copied your command:

# [ -f /home/my-user/.ssh/id_rsa ] && echo it is there
it is there
# mender-artifact write rootfs-image -f ssh://username@hostname -n NAME --software-version SOFTWARE_VERSION -o file.mender -t TYPE --ssh-args="-o IdentityFile=/home/my-user/.ssh/id_rsa" --ssh-args="-o IdentitiesOnly=yes"
0%                              50%                              100%

and as you can see it started making the artifact. Could you verify that you supply the absolute path to an existing identity file?

best regards,

Hello Peter,

thanks a lot for your response and the hint with the first echo command.
Sometimes this typo issues are just for users who trying things on Monday… :wink:

Wish you all the best,

Hello Andreas,

thank you :slight_smile:
that is why I start on Tuesdays :slight_smile:
great to hear it is working for you.

have a good week,