Lxc file push to invisible (dot) subdirectories

snap, version 4.0.0, ubuntu 18.04.

lxc file push authorized_keys container/home/user/.ssh/ fails with error message Error: file does not exist.

lxc file push authorized_keys container/home/user/ works but is not the intended outcome.

Searching the web did not yield any useful pointer. Anybody has a workaround? a fix?

Does the .ssh directory exist?

same error whether the .ssh directory exists or not. My use-case is for a not-existing directory, but if there is a workaround to create and set its ownership before uploading the file, I am fine with both cases.

stgraber@castiana:~$ touch authorized_keys
stgraber@castiana:~$ lxc file push authorized_keys b1/root/.ssh/
Error: file does not exist
stgraber@castiana:~$ lxc exec b1 -- mkdir -p /root/.ssh
stgraber@castiana:~$ lxc file push authorized_keys b1/root/.ssh/
stgraber@castiana:~$ 
stgraber@castiana:~$ lxc exec b1 -- rm -rf /root/.ssh
stgraber@castiana:~$ lxc file push authorized_keys b1/root/.ssh/ -p

Thanks for looking into this, Stéphane. I think the problem sits between the headrest and the monitor :sweat:. Following your example works. The only thing that changed (and should be irrelevant) is that I tested at my desktop, not at my laptop. I went back into my bash history to try to determine what I did wrong, but was unable to find anything. Apology for the waste of time.