Lxc image import fails with error: open lxd.tar.xz: no such file or directory, even if that file exists

Hello to eveybody.
I am trying out this website, https://book.hacktricks.xyz/linux-unix/privilege-escalation/interesting-groups-linux-pe/lxd-privilege-escalation

In order to achieve the user escalation project and exploit the lxd vulnerability.

Everything works fine, I upload the two files(lxd.tar.xz and rootfs.squashfs into the vulnerable server) until I get to this command:

lxc image import lxd.tar.xz rootfs.squashfs --alias alpine

ash@tabby:/tmp$ lxc image import lxd.tar.xz rootfs.squashfs --alias alpine
lxc image import lxd.tar.xz rootfs.squashfs --alias alpine
Error: open lxd.tar.xz: no such file or directory

The problem is that I have access of that folder (/tmp/) and the two files are normally there.

I am using the PWNBOX of hackthebox, which is Kali Linux for this project, which is later on to be upgaraded in a full thesis, so I would appreciate any help, since I am literally stuck there.
My target PC is a PC hosted in the HackTheBox OpenVPN and my attacker is just a user in a VM Kali Linux terminal, in bridge mode if that matters, also connected in the HackTheBox OpenVPN.

So, I am doing every same movement this very user is doing, but when I come to this command, it just gives me this error and I literally can’t understand what’s happening here.

Thanks for your time. I would really appreciate any help, so I can get around this seemingly easy task.

Try from a path other than /tmp, /tmp is a bit special in that different applications may have a different view of things. Alternatively, try using an absolute path like /tmp/lxd.tar.xz /tmp/rootfs.squashfs, maybe that will work.

1 Like

This did not work, unfortunately :frowning:

ash@tabby:/tmp$ lxc image import /tmp/lxd.tar.xz /tmp/rootfs.squashfs --alias alpine
</tmp/lxd.tar.xz /tmp/rootfs.squashfs --alias alpine
Error: open /tmp/lxd.tar.xz: no such file or directory

temp should be fine, but I am going to test this out tomorrow.

Anything else in mind?

Really appreciate the answer!!!

Don’t use web shell to do it.Using ssh to login to ‘tabby’ ,then download that two files and execute
commands will be work