I am currently writing a little script that should automatically be executed as soon as certain users log onto the server. They are then allowed to add a user and should be logged out afterward instantly so that they dont meddle with my server. To achieve this i wrote the following function:
def logout_fkt():
logout = input("Do you wish to log out ? (yes / no): ") # Maybe the user wants to add another user
if logout == 'no':
add_user()
else:
os.system("logout")
The servers runs on the ubuntu20.04 so the command logout definitly exists. But somehow if i execute it via the os.system() i get the following error message: sh: 1: logout: not found which would indicate that the command does not exist, which of course is not true. I am lost.