DesktopLinux
Home  |  News  |  Articles  |  Forum  |  Polls  |  Blogs  |  Videos  |  Resource Library

Keywords: Match:
Logging your kids off your Linux desktop
by Steven J. Rosen (Jul. 21. 2006)

You sit down at your desk for a relaxing session on your Linux computer, only to find that someone is already logged on. Of course, you could start a new session; Linux makes this easy. But you shouldn't have to -- the kids are long gone, to bed or playing, and your spouse never uses this computer.

This is a frequent occurrence in my house. The kids are always stopping their sessions to run off and play. Sometimes they leave things running, with annoying game music coming from the speakers or documents left unsaved.

How do you log them off when they're not around? Actually there are several ways to do it; I'll describe two ways. You'll have to become the root user for both of them.

The mean way

This method guarantees your kids will complain to you. Well, OK, any method guarantees that. But this method is especially mean because there's no chance to save the other user's work first.

Note that this method works only when the other user is running KDE. There may be a similar method for GNOME, but I haven't investigated it.
  1. Logon to KDE. (This is not strictly necessary, but it simplifies one of the later steps.)

  2. Open a terminal window and become root:

      steve@pogo:~> su -
      Password:
      pogo:~ #


  3. Now, become the user whom you want to log off. In the example below, the user is amanda:

      pogo:~ # su - amanda
      amanda@pogo:~>


  4. The next part is a bit tricky. You have to figure out which X display on which Amanda is running. In the KDE menu, select the Switch User menu entry. You'll see a list of the logged-on users, along with their X display numbers and "vt" (virtual terminal) numbers. In our example, Amanda's entry might look like "Amanda: kde (:0, vt7)" (see screenshot, below). This tells you that the X display is ":0".

    KDE's Switch User menu, showing the logged-on users along with their X display numbers and virtual terminals.

  5. Back in the terminal window, set the DISPLAY environment variable to the value of the X display; make sure to include the colon (":") as part of the value:

      amanda@pogo:~> export DISPLAY=:0

  6. Finally, issue the fatal command to kill amanda's KDE session:

      amanda@pogo:~> kdeinit_shutdown

That's it! Once you issue the kdeinit_shutdown command, all traces of the other person's KDE session will disappear. Along with any documents on which that person was working.

The kinder, gentler way

The second method simply unlocks the other user's session, allowing you to do, well, pretty much anything. I trust that you will only do good things, such as save the user's open documents, before logging the user off.

This method works whether the user is running a KDE or GNOME session, although the commands are different. However, you don't have to start a new KDE or GNOME session; you can use a terminal or even do this over telnet or ssh.
  1. At a command line, become root.

  2. Find out the process id (PID) of the other user's screen locking program. In KDE, this program is called kdesktop_lock. Run the following commands to find its PID, substituting the user name for amanda:

      pogo:~ # ps -ef | grep amanda | grep kdesktop_lock
      amanda 10689 10653 0 01:12 ? 00:00:00 /opt/kde3/bin/kdesktop_lock --forcelock


    The PID is the first number, 10689.

    In GNOME, a program called gnome-screensaver locks the user's desktop:

      pogo:~ # ps -ef | grep amanda | grep gnome-screensaver
      amanda 12182 1 0 01:19 ? 00:00:00 gnome-screensaver
      amanda 12192 12182 1 01:20 ? 00:00:00 /opt/gnome/lib/gnome-screensaver/gnome-screensaver-dialog --enable-switch


    As you can see, there are two processes shown; you want the first one, with PID 12182.

  3. Kill the locking process:

      pogo:~ # kill 12182

You're done. Now you can switch to the other user's session, save anything that needs it, and log the user off.

Maybe you'll even get a "Thanks, Dad" or "Thanks, Mom" for your efforts. Nah, these are your kids we're talking about!



Copyright (c) 2006 by Steven J. Rosen. All rights reserved. Reproduced by DesktopLinux.com with permission.



Do you have comments on this story?


Talkback here

NOTE: Please post your comments regarding our articles using the above link. Be sure to use this article's title as the "Subject" in your posts. Before you create a new thread, please check to see if a discussion thread is already running on the article you plan to comment on. Thanks!


About the Author


Steven J. Rosen has been a software developer and systems engineer for over 20 years with IBM and Lockheed Martin Corporation. For the last 11 years, he has primarily developed large government software systems on Unix using C++. He began using Linux on his home computers four years ago, starting with Mandrake Linux 8.1, and has used it ever since. He lives in Maryland with his wife and two children.


Related Stories


(Click here for further information)


Approaching the Linux Desktop
The purpose of this paper is to help organizations evaluate the Linux desktop against their own enterprise needs and discover what benefits the Linux desktop might bring to their organizations.

Migrating To Linux: Application Challenges and Solutions
Several solutions exist to help organizations migrate in an orderly fashion from Windows to Linux desktops. This paper establishes the characteristics of an ideal cross-platform solution and reviews these alternatives in light of this ideal standard. The paper takes a closer look at the pros and cons of various solutions and outlines the business benefits that can be achieved.

Linux Advantages: Publicly Available Information on Linux Software
This paper offers a brief summary of readily-available Linux information to help businesses sort out this widely misunderstood operating system.

Top 5 Strategies for Managing Linux
Despite continuous evolution in the manageability of Linux, a 2006 survey cited manageability concerns as a top reason why organizations are hesitating to adopt Linux. Levanta believes Linux can be as manageable, if not more so, than other operating systems by following key strategies. These strategic recommendations were developed from experiences in numerous customer environments, both large and small.

Why Choose Novell for Linux?
This paper outlines the benefits of switching to the Linux platform and choosing Novell as a high-performance, enterprise solution.

Enterprise Linux Selection Guide
Considering moving your enterprise to the Linux operating system? Since there are so many similar versions, choosing the right one can be tough. This paper offers a clear process to help you make an informed decision and get the features, support, and cost that are right for your business and technical needs.

Overcoming Challenges in Managing Linux
Levanta has created a new administration model with innovative technology that breaks down the barriers to making the most of Linux systems. This paper will provide an in-depth look at the workings of Levanta’s product, the first Linux appliance of its kind.

SUSE Linux Enterprise 10 for Retail Businesses
Discover why major retailers have switched to SUSE Linux Enterprise Desktop in the back office. SUSE Linux Enterprise Desktop 10 is a low-cost desktop that offers a complete set of productivity applications and interoperates seamlessly with the other Windows, Macintosh and UNIX desktops in your store.

Moving to a Linux Desktop
Migrating from Windows to Linux on the desktop can be a substantial undertaking because it has the potential for touching -- and perhaps disrupting -- every user in your organization. Unlike a data center (server and infrastructure) migration that is largely transparent to users, the cultural and administrative transitions and environment readiness required to support a Linux desktop migration are extensive.

Seven Good Reasons to Exchange Exchange
This paper describes seven compelling reasons why you should switch from Exchange to Scalix.

 



Got a HOT tip?   please tell us!

ADVERTISEMENT
(Advertise here)

Resource Library

• Unix, Linux Uptime and Reliability Increase: Patch Management Woes Plague Windows Yankee Group survey finds IBM AIX Unix is highest in ...
• Scalable, Fault-Tolerant NAS for Oracle - The Next Generation For several years NAS has been evolving as a storage ...
• Managing Software Intellectual Property in an Open Source World This whitepaper draws on the experiences of the Black Duck ...
• Open Source Security Myths Dispelled Is it risky to trust mission-critical infrastructure to open source ...
• Bringing IT Operations Management to Open Source & Beyond Download this IDC analyst report to learn how open source ...


Popular recent stories:
• Linux an equal Flash player
• Linux, netbooks threaten Microsoft's fat profits
• gOS 3.0 goes gold
• Browser swallows OS
• Lenovo denies ditching Linux
• Lightweight, Linux-compatible browser evolves
• GNOME 2.24 gains "Empathy" IM
• Review: Pardus Linux
• Ubuntu to fund Linux development
• Ubuntu "Intrepid Ibex" available

All-time Classics:
• Choosing a desktop Linux distro
• Banshee -- the next best thing to Linux iTunes
• Running World of Warcraft on Ubuntu
• A simple Linux backup method
• The Best Free Desktop Linux . . . and how to make it better
• Linux-powered Asus Eee PC mini-laptop arrives
• The well-tempered Debian desktop
• Lenovo launches a netbook
• What's the best Linux for beginners?
• Getting to know Puppy Linux
• Xandros 4: The best desktop Linux for Windows users
• VirtualBox: The best virtualization program you've never heard of

Linux-Watch headlines:
• Opinion: Absolutism hurting Debian
• Linux patent program finances "defensive publications"
• Linux Foundation announces TAB electees
• Mistah SCO -- he dead
• Worst security blooper ever?
• Novell offers RHEL, CentOS support
• Windows 7 no threat to netbook Linux
• Microsoft breaks HotMail for Linux users?
• Torvalds: Real quality means taking it personally
• Opinion: open source value transcends tough times


Join our Desktop Linux discussion forums:
•  Moving to Linux
•  Linux/Windows debate!
•  Linux Q&A
. . . and more

Visit the...

BREAKING NEWS

• A peek at Phoenix HyperSpace
• Linux desktop gains kid-friendly browser
• OpenSUSE Community Manager discusses 11.1 release
• "...and I'm Linux" video contest approaches
• OpenSUSE rev's license, build system
• Linux gains fresh "AIR"
• Video-call software boasts HD quality
• Sun rev's "open source" desktop VM manager
• Open source music player rev's up
• Fedora 10 dubbed a "solid" chapeau
• HP preinstalls Linux on SMB desktop
• Linux Foundation announces TAB winners
• Netflix coming to Linux desktops?
• Which is the best Linux office suite?
• IBM pushes "Microsoft alternative" desktop



Linux Netbooks


Linux smartphones!


news feed

Home  |  News  |  Articles  |  Forum  |  Polls  |  About  |  Contact
 

Ziff Davis Enterprise Home | Contact Us | Advertise | Link to Us | Reprints | Magazine Subscriptions | Newsletters
Tech RSS Feeds | White Papers | ROI Calculators | Tech Podcasts | Tech Video | VARs | Channel News

Baseline | Careers | Channel Insider | CIO Insight | DesktopLinux | DeviceForge | DevSource | eSeminars |
eWEEK | Enterprise Network Security | LinuxDevices | Linux Watch | Microsoft Watch | Mid-market | Networking | PDF Zone |
Publish | Security IT Hub | Strategic Partner | Web Buyer's Guide | Windows for Devices

Developer Shed | Dev Shed | ASP Free | Dev Articles | Dev Hardware | SEO Chat | Tutorialized | Scripts |
Code Walkers | Web Hosters | Dev Mechanic | Dev Archives | igrep

Use of this site is governed by our Terms of Service and Privacy Policy. Except where otherwise specified, the contents of this site are copyright © 1999-2008 Ziff Davis Enterprise Holdings Inc. All Rights Reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff Davis Enterprise is prohibited. Linux is a registered trademark of Linus Torvalds. All other marks are the property of their respective owners.