Commit 19a2b822 authored by Jakob Moser's avatar Jakob Moser
Browse files

Chown vault so that normal user can read/write to it

parent e48ba9c1
Loading
Loading
Loading
Loading
+8 −0
Changes for poolpay/vault/Vault.py: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
from dataclasses import dataclass
from os import getgid, getuid
from pathlib import Path
from subprocess import CalledProcessError, run
from uuid import uuid4
@@ -46,6 +47,13 @@ class Vault:
        )
        self._cryptsetup_open(password)
        run(["sudo", "mkfs.ext4", "-L", "poolpay-vault", f"{self._mapper}"], check=True)
        self._mount()
        run(
            ["sudo", "chown", f"{getuid()}:{getgid()}", f"{self.mountpoint}"],
            check=True,
        )
        self._umount()

        self._cryptsetup_close()

    def _cryptsetup_open(self, password: str) -> None: