Fix encryption (thanks Ved)

This commit is contained in:
Fierelier 2022-06-20 17:05:59 +02:00
parent 248972ad83
commit 63f7125155
2 changed files with 14 additions and 2 deletions

View File

@ -86,7 +86,6 @@ ff02::2 ip6-allrouters\
print("Encrypt user? Recommended for machines that may be stolen or spying relatives. (y/n)")
encrypt = mchoice(["y","n"])
ucommand = ["adduser"]
if encrypt == "y": ucommand.append("--encrypt-home")
ucommand = ucommand + ["--gecos","",username]
try:
@ -104,6 +103,19 @@ ff02::2 ip6-allrouters\
call(["usermod","-a","-G","sudo",username])
except:
print("Warning: Couldn't add user to sudo group!")
if encrypt == "y":
call(["modprobe","ecryptfs"])
with opem("/etc/modules","a",encode="utf-8") as mfile:
mfile.write("ecryptfs\n")
call(["ecryptfs-migrate-home","-u",username])
for root,dirs,files in os.walk("/home"):
for files in dirs:
ffile = os.path.join(root,file)
lfile = ffile.replace("/home/","",1)
if lfile.startswith(username + "."):
shutil.rmtree(ffile)
break
break
print("")

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
export OPUS_PACKAGES="$OPUS_PACKAGES sudo keyboard-configuration network-manager python3 ecryptfs-utils"
export OPUS_PACKAGES="$OPUS_PACKAGES sudo keyboard-configuration network-manager python3 cloud-utils ecryptfs-utils rsync lsof"
export OPUS_PACKAGES_DL="$OPUS_PACKAGES console-setup locales tzdata"