I think we should replace mv with sudo cp && rm (or add chown 0:0 after mv) elsewhere to ensure root:root ownership. For example, shim.env is owned by SSH user (as it uploaded via SFTP):
# ls -l /root/.dstack
total 33236
-rw-r--r-- 1 root root 278 Mar 26 14:24 host_info.json
drwxr-xr-x 11 root root 4096 Mar 26 16:26 runners
-rw-rw-r-- 1 debian debian 395 Mar 26 14:24 shim.env
-rw-r--r-- 1 root root 34015187 Mar 27 07:14 shim.log
Originally posted by @un-def in #3702 (comment)