How can you log out via the terminal?


There’re many desktop environments that work on Ubuntu system. Sometimes panel may disappear or error load after configuration error. This tutorial will show you how to log out Unity, Gnome Shell, KDE, Xfce desktop via command in terminal from Ubuntu 12.04 Precise.

For Unity, gnome-shell and gnome-classic, run this command: gnome-session-quit

You’ll see this old gnome log-out dialog with 60 seconds timeout.

For Xubuntu, Xfce desktop, run this command: xfce4-session-logout

It launches normal shutdown/reboot/logout dialog.

For Kubuntu, KDE4 desktop, I found this command (without test):

qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout -1 -1...

0 0

In the never-ending search to work smarter, not harder, few things can be simpler than entering commands on one Mac and having them pushed out across the entire LAN to multiple nodes.

One of these perks comes natively to OS X by way of SSH—the remote access network protocol that encrypts communication from end-to-end between server and client machine.

Unfortunately (for Mac sysadmins), Remote Login—as Apple refers to it—comes turned off, by default (fortunate for security admins). Turning the service on involves very little manual intervention, but when you multiply that by the number of Macs to administer, the task becomes incredulously time-intensive.

On the plus side, there is a command that can be executed to turn on the SSH service, and another couple of commands can optionally configure the service and secure it so that only those requiring secure access will be authorized to do so. Let's take a closer look.

Enabling SSH

To enable SSH,...

0 0

This solution requires the use of Terminal, an app included in Mac OS. It is an advanced-user app that might be intimidating for basic users but is quite simple to use, at least for the intentions of this solution.

The instructions are written for the inexperienced-in-Terminal basic user. Otherwise, this solution can be inferred by the solutions posted in the links at the end of this post.


Having Skype already installed in your computer and already open:

1. Open Terminal. (If you don't know where to find it you can search it using Spotlight)

2. On the window that Terminal opens (a white window with a line of text awaiting for you to type) write: "sudo /Applications/" (you can copy&paste from here, it has to be everything between the quotation marks, including the space between "sudo" and "/App..." EXCLUDE the quotation marks).

3. Terminal will ask for your user account password (the same you use...

0 0
0 0

When I'm primarily using the keyboard, I find it a bit annoying to have to switch to the mouse for anything (even if just to logout). Normally, if you type logout in your Terminal window, your shell quits, but of course, you're still logged in to OS X. Add the following shell function to your




, or wherever else depending on your setup), and voila -- you really


log out...

logout() { osascript -e 'tell application "System Events" to log out' builtin logout }


robg adds:

Depending on the state of your windows, you'll probably have to dismiss some dialog boxes in order to complete the logout, but this can be done using the keyboard as well. I'm not sure I'd replace the built-in


function, as I've become quite used to using it to just logout from the Terminal. Instead, you might want to change the command's name to


, or something else, in order to prevent an accidental total...

0 0
0 0
0 0
Just thought of a situation where logging out would kill a background process, and that's precisely what you're describing, Viro... if you have a process that reads from stdin or outputs to stdout, then you MUST redirect stdin and stdout to somewhere else (files, maybe), because when you log out, stdin and stdout pipes are closed, and then the program would fail.

Since compilers like cc and gcc output to stdout and stderr by default, when you log out, then next write to stdout or stderr would fail, and bring the script to a screeching halt.

If you re-route stdin and stdout (and, possibly, stderr) early in the script, backgrounding your compile script then logging out should allow it to continue...

0 0
gnome-session-quit dbus-send --session --type=method_call --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.Logout uint32:1

(via DoR, see his answer to "Reboot without sudoer privileges?" for more dbus goodness!)

or alternatively, you can use

gnome-session-save --force-logout

--force-logout in contrast to just --logout will not ask the user to deal with unsaved documents and so on.

is this the easiest way? no simple one line command like sudo logout?? I will never remember all that.

Yes, there is a command called logout, but it concerns the Terminal. gnome-session-save is the program that actually quits the gnome-session, which you can of course kill, but that wouldn't qualify as logging out. :-)

Notice as well that these commands don't require you to be root.

You can always add an alias to your system if you want to have a shorter command.

Open ~/.bash_aliases with a text editor,...

0 0
0 0

You can do that with a combination of the BatchMode option and "parsing" the output. (ssh always returns 255 if it fails to connect for whatever reason, so you can't use the return code to distinguish between types of failures.)

With BatchMode on, no password prompt or other interaction is attempted, so a connect that requires a password will fail. (I also put a ConnectTimeout in there which should be adjusted to fit your needs. And picked really bad filenames.)

#! /bin/bash rm good no_auth other while read ip host ; do status=$(ssh -o BatchMode=yes -o ConnectTimeout=5 $ip echo ok 2>&1) if [[ $status == ok ]] ; then echo $ip $host >> good elif [[ $status == "Permission denied"* ]] ; then echo $ip $host $status >> no_auth else echo $ip $host $status >> other fi done < list.txt

You could detect other types of errors (like missing server public key) if you need more detailed classification. If you need the results in a single, sorted file, just cat...

0 0

We have a bunch of servers that our engineers remote desktop into, but each server has a two connection limit. We will often attempt to RDP into these boxes and we will see the "This machine has exceeded the maximum number of connections" message.

It's a big pain because we have sent out several email messages to these users, and they never get the point.

I know how to connect to the root console and boot people, but I'd prefer not to do that. I also know that there are ways of booting inactive sessions after a period of time, and I don't want to do that either.

I want to force users to learn that they need to log out. This doesn't happen if you log them out manually (plus logging them out manually is a pain). If you just log them out manually, these engineers won't think twice about staying connected in an RDP session because it is convenient for them.

I would prefer some notification system where the inconsiderate user is notified via email or NET SEND...

0 0

That ATM installed in the wall of your local convenience store or bank might look like an easy way to get some cash in your pocket, but you need to make sure that the scammers didn’t get there first.

You Use ATMs All The Time, Right?

You pass an ATM, you get money out of your account. Perhaps you’re heading out for drinks, or you’re paying a tradesman who doesn’t take credit cards or cheques. Heading to the market or a farm shop, sponsoring the neighbour’s kids to eat 30,000 chocolate buttons or even paying the milkman or window cleaner – all of these things need cash.

While it would seem to be unwise to keep all of your money in one bank account (or even in banks at all in some parts of the world) the fact remains that ATMs remain a popular method for withdrawing money. After all, most of us can’t make it to the bank during business hours, and even if we could, the queuing is inconvenient.

No – it’s much easier to use an ATM to withdraw money...

0 0

Theoretically, you can solve any resource problems by adding more hardware -- and when one server isn't enough, you add more servers. But sustaining an inefficient solution by feeding it money starts to become impractical at a certain point.

On the one hand, rewriting an existing app as a scalable service is expensive, so simply deploying it as a terminal services solution seems a simpler path. But on the other hand, the solution scales dramatically more poorly than something like a web app.

First of all, a TS solution is "heavy" and persistent. A set of new processes starts for each user which persist until that user logs off, each of these consumes memory and processor time above and beyond that consumed by your actual application. And, of course, a TS application is much more server-intensive than a web app because all of the work, even rendering the UI, is done server-side.

The actual limits are tough to predict up front, but you should be able to do some...

0 0

Most Windows Server's components including Terminal Services can be configured and hardened through Group Policy...

By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.

You also agree that your personal information may be transferred and processed in the United States, and that you have read and agree to the Terms of Use and the Privacy Policy.

settings. The benefits of using these settings are improved server security and performance.

Locating Group Policy settings
Terminal Service related Group Policy settings are stored in two locations within the Group Policy Object Editor. Computer related settings are located at Computer Configuration \ Administrative Templates \ Windows Components \ Terminal Services, while user specific settings can be found at User Configuration \...

0 0