Private snap download

Hi I have a private snap that I want to install on an Ubuntu Core system without logging into Snapcraft credentials. How can I install private snaps without using snap login? Is there any way to I can give access to my private snap when I am creating the Ubuntu Core image?

You can pass UBUNTU_STORE_AUTH_DATA_FILENAME="..." to ubuntu-image when creating an Ubuntu Core Image.

See this post for the technical detail and this doc for exporting your credential. You can also check snapcraft export-login --help to limit the usage of your exported credential.

I have passed my credentials through $ export SNAPCRAFT_STORE_CREDENTIALS=$(cat ) when I am creating an ubuntu core image and also I have given my credentials when I am logging into Ubuntu Core OS but I am not getting access to my private snap. tell me any other solutions

I don’t know if ubuntu-image takes the SNAPCRAFT_STORE_CREDENTIALS environment variable. I guess no, because there’s no such string in the snap program which is called by ubuntu-image to generate the content of image.


Can you suggest me when I can define this like process UBUNTU_STORE_AUTH_DATA_FILENAME

You could define this environment variable before calling ubuntu-imageby using either env UBUNTU_STORE_AUTH_DATA_FILENAME="/path/to/your-creds" ubuntu-image snap ... or export UBUNTU_STORE_AUTH_DATA_FILENAME="path/to/your-creds"; ubuntu-image snap ...

whenever I am trying to create ubuntu core with above process I am getting error as "ubuntu-image snap my-model.model Error: Error preparing image: cannot decode auth file “credentials.txt”: invalid character ‘e’ looking for beginning of value "

{ “type”: “store”, “data”: { “username”: “your_snapcraft_username”, “password”: “your_snapcraft_password_or_token” } } In this format I have stored my credentials as ‘auth.json’ but when I am trying to run “export UBUNTU_STORE_AUTH_DATA_FILENAME=”/home/akshay/anand/ubuntu-core-22/new/auth.json"; ubuntu-image snap my-model.model" I am getting error as " Error: Error preparing image: invalid auth file “/home/akshay/anand/ubuntu-core-22/new/auth.json”: missing fields "

Can please tell me what was the issue