Find out if there is a local user logged in when logging in over ssh
Posted
by
sebastiangeiger
on Ask Ubuntu
See other posts from Ask Ubuntu
or by sebastiangeiger
Published on 2012-05-31T16:00:32Z
Indexed on
2012/05/31
16:50 UTC
Read the original article
Hit count: 262
I need to run some calculations on a machine that I can only access remotely but also serves as a work station. There are many of them and I want to pick a "free" one. Free means in this case that no one is logged in locally.
My first try was the who
command, but for some reason it only lists "selected" users and I can't really find out how they are selected.
Next try: ps aux | cut -d " " -f1 | sort | uniq
: better showing a bunch of demons but also the local user that was not displayed by who
.
My current solution is to go in and do ps aux | grep "gnome-session"
which is better but still gives me a lot of junk. Ideally I am looking for something that I can include in my ssh profile that warns me about (active) local users when I log in.
© Ask Ubuntu or respective owner