2

I know that if I open Terminal and I type inwho, it shows who is logged in and at what time, etc. However, I am not going to be at Terminal all day and keep typing who. So, I would like a notification that appears when someone logs into my computer, or in this case, when someone ssh's into my computer. Is there some way to do this in Applescript? Thanks for your help!

3
  • Check out this question apple.stackexchange.com/questions/45688/…
    – orkoden
    Dec 13 '15 at 23:10
  • @orkoden I have looked at that, doesn't seem to fit what I want to do. The person there wants to setup a notification for when someone logs into a server not a computer.
    – ThoughToo
    Dec 13 '15 at 23:27
  • A server is a computer.
    – orkoden
    Dec 14 '15 at 9:43
2

Applications like Growl or GeekTool may be able to help you with this. Growl can send messages to the Notification Center or use its own notifications; when coupled with an external system application like Log Surfer, it may be able to provide the notification you seek.

GeekTool would be much easier to setup, but doesn't send info to the Notification Center. Instead, you can have it display the output from a standard UNIX command on your desktop. In particular, you could have it display the output of a 'who' command, and update that every few seconds.

1
  • You can add commands to /etc/bashrc that will be executed by anyone logging in. However, a command executed from within a Bash shell owned by another user can not write to the display owned by the desktop user -- ergo, notifications won't appear if requested by someone logging into a SSH session. That said, you can display a notification from AppleScript in a shell script as follows: osascript -e 'display notification "This is a test." with title "Test Message"'
    – Alphaman
    Dec 14 '15 at 2:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .