Skip to content
Snippets Groups Projects
Commit 98827f53 authored by Jeremy Whiting's avatar Jeremy Whiting
Browse files

Use getpass.getuser() instead of os.getlogin() since we are a service.

os.getlogin() doesn't work when launched by systemd since there's
no login terminal to get the password from.
https://linux.dio.net/man/3/getlogin
parent f9823c26
Branches
Tags v0.20220330.1
No related merge requests found
......@@ -25,6 +25,7 @@
from http.server import BaseHTTPRequestHandler
import configparser
import getpass
import json
import os
import platform
......@@ -365,7 +366,10 @@ class DevkitService:
if 'ShellUsers' in users:
DEVICE_USERS = users["ShellUsers"]
else:
DEVICE_USERS = [os.getlogin()]
username = getpass.getuser()
print("Username: {username}")
DEVICE_USERS = []
DEVICE_USERS.append(username)
# If only one user, that's the entry point user
# Otherwise entry_point_user needs to be root to be able to switch between users
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment