Score:0

How can I logout an idle user from the Ubuntu GUI desktop using CLI?

cn flag

I am using an Ubuntu GUI desktop and users log in to the desktop via their browser. Using the command loginctl, I can get the list of user sessions. But there are some idle users who have not logged out for a long time and their session persists.

Is there a way to determine the idle users (say x minutes of inactivity) and terminate their sessions using the command loginctl terminate-session <session-id>?

I have tried understanding the systemd-logind service and logind.conf file but could not find a proper solution.

w or who command do not provide the required output.

vanadium avatar
cn flag
How can users login via their browsers? Please give detail on how you made this work.
Doom avatar
cn flag
I am using an AWS Marketplace AMI which allows this feature
nobody avatar
gh flag
`sudo loginctl terminate-user username` Kills all processed and all sessions from user.
Doom avatar
cn flag
Yes, that would be helpful in process and session termination but how do we find out that a particular user is idle for x minutes and then terminate the session.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.