Wpis z mikrobloga

#linux #backend #debian

Chcę folder który jest widoczny tylko dla procesu i usuwany po zakończeniu procesu.
W procesie wyciągam tylko co potrzebuję z tymczasowego folderu.

Trafiłem na to:
https://blog.famzah.net/2014/06/04/private-tmp-mount-per-process-in-linux/

TARGET_USER='www-data'
TARGET_CMD='/bin/bash' # but it can be any command
NEWTMP="$(mktemp -d)" # securely create a new empty tmp folder



chown "root:$TARGET_USER" "$NEWTMP"
chmod 770 "$NEWTMP"



unshare --mount -- /bin/bash -c "mount -o bind,noexec,nosuid,nodev '$NEWTMP' /tmp && sudo -u '$TARGET_USER' $TARGET_CMD"
Czy to dobre rozwiązanie?

Ogólnie działa ale wyświetla mi błędy:

remote: chown: changing ownership of '/tmp/tmp.mXBZSE0oFr': Operation not permitted
remote: unshare: unshare failed: Operation not permitted

I od rsync:

remote: rsync: chgrp "/var/www/domena.ma/." failed: Operation not permitted (1)