borgextend/tools/borg-restricted.py

17 lines
290 B
Python
Executable File

#!/usr/bin/env python3
import os
import pwd
import subprocess
cur_user = os.geteuid()
homedir = pwd.getpwuid(cur_user).pw_dir
borg_bin = '/usr/bin/borg'
os.chdir(homedir)
subprocess.run([borg_bin,
'serve',
'--restrict-to-path',
homedir])