Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Having fun on April 1st with SSH UNIX

Inspired by the latest MacAddict's April Fools' pranks, here are some very handy commands to remotely control a computer of which you are an administrator. These are most useful in a family environment where you own and administer the others' computers. They also work well over AirPort.

First, you need to ssh to the computer using your admin account. Then, you can type in any or all of the following commands.

[robg adds: Read the rest of the article for the pranks. Please note that some of these are quite nasty! Using your power as Admin to remotely reboot someone's machine, for example, is a simply horrendous thing to do. With that said, however, some of the following would be quite fun to do to someone with a good sense of humor...]

Note: Commands that are shown on two lines have the second line indented by two spaces. Enter the command on one line, removing all but one space between the end of the first displayed line and the start of the second...

Absolutely nasty:

sudo kill [program id learned from top] 
Note: using 'sudo open' over ssh does not give the user super-user privileges for the opened application.
sudo halt
sudo reboot
sudo osascript -e 'tell app "[name of an open program]" to quit'
Power:
sudo osascript -e 'tell app "Finder" to sleep'
sudo osascript -e 'tell app "Finder" to shut down'
General:
sudo open /Applications/iChat.app
sudo osascript -e "set volume 0"
sudo osascript -e "beep"
sudo osascript -e 'display dialog "Did you know that you are annoying?" 
  buttons "Yes" with icon note'
sudo osascript -e 'tell app "Finder" to quit'
sudo open [path to an application]
Speech:
sudo osascript -e 'say "[whatever]" using "Zarvox"'
sudo osascript -e 'say "Dum dum dum dum dum dum dum he he he ho ho ho fa 
  lah lah lah lah lah lah fa lah full hoo hoo hoo" using "Cellos"'
iTunes Control:
sudo open /Applications/iTunes.app; sudo osascript -e 'say "Play some music.
  Go on.  I dare you." using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to stop' -e 'say "Please stop playing
  your annoying music" using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to next track' -e 'say "I did not like
  that song very much" using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to fast forward' -e 'say "This song is 
  boring" using "Zarvox"'
sudo osascript -e 'tell app "iTunes" to quit'
Have fun, but not too much fun!
    •    
  • Currently 4.10 / 5
  You rated: 5 / 5 (10 votes cast)
 
[102,642 views]  

Having fun on April 1st with SSH | 28 comments | Create New Account
Click here to return to the 'Having fun on April 1st with SSH' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Having fun on April 1st with SSH
Authored by: tjormola on Mar 31, '03 11:22:08AM

Gee, Mac people are discovering Unix. Isn't that cute? Good for them, though.



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: persson on Mar 31, '03 11:32:48AM

Wow tjormola, you must have worked with some pretty nifty versions of *nix if you have always had an environment with built in and reliable text-to-speech and system wide scripting capablity for gui applications! ;-) To me the fact that I can do these things on a Mac isn't a surprise since the the Mac OS has had these capabilies for year, but that fact that I can do it while logged in remotely with the power of sudo still causes me to smile and giggle!



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: persson on Mar 31, '03 11:45:33AM

Of course I meant to say, "the Mac OS has had these capabilities for years".

Somehow Applescript seems so much more powerful than xmesg. I am sure that an expert with gnome or kde (or a Tk guru using wish) could accomplish many of the same tricks under X, but clearly that is no where near as easy to do and requires that the 'victim' have the appropriate windowing environment in place.

It does make me realize that I need to look around and see if the venerable xroaches has been cloned for OSX though!



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: nick on Mar 31, '03 11:29:36AM

quite cool also:

- install ohohoneX (http://sourceforge.net/project/showfiles.php?group_id=74721) on your computer and the client-computer

- start ohphoneX in "Auto-answer Incoming Calls"-mode

- ssh to the client-computer

- cd /Application/ohphoneX.app/Contents/Resources/ (or where ever you installed ohphoneX)

- ./ohphoneX 192.168.0.1 (or what the IP of the client is). as this is the command-line-application, the user of your choice won't realise that the app is running

- start talking to the user of your choice



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: network23 on Mar 31, '03 11:43:36AM

lots of ways to make a remote mac sleep. How do you get one to wake?

---
Live and Direct, only from
Network 23



[ Reply to This | # ]
Wake On LAN
Authored by: Pi_ on Mar 31, '03 12:11:06PM

Ensure that the Wake For Network Admin Access is enabled in energy saver. Then you have to send a special packet to the MAC address. Google for "Wake on LAN" for a Unix program to do this :)

Pi



[ Reply to This | # ]
Wake On LAN -- through NAT router?
Authored by: ddldreaming on Mar 31, '03 08:56:08PM
Has anyone figured out how to make WoL work through a broadband router performing NAT hiding? I've tried through both an SMC Barricade and an Airport Base Station, forwarding various ports to the desired Mac (TCP port 9, which is the 'discard' port, is what's suggested most often on websites covering the subject), with no luck so far. I can ssh into my Mac remotely, once it's awake -- it's just a matter of getting that special ethernet packet repeated through the router.

[ Reply to This | # ]
Wake On LAN -- through NAT router?
Authored by: greed on Apr 01, '03 11:00:55AM

A NAT router only does IP, wheras the WoL packet has to be at the Ethernet layer (below IP), so you can't send it through a router.

I have a Linux server I can always SSH to, and from there I can wake up the Mac. Except if the lid is closed... and my iMac pre-dates WoL on Macs... so I just leave the iMac on anyway.



[ Reply to This | # ]
Wake On LAN -- through NAT router?
Authored by: SeanAhern on May 19, '03 05:14:41PM

Well, I'm able to wake my home machine from broadbandreports.com (http://www.broadbandreports.com/wakeup). According to traceroute, there are over 15 machines between them and my Mac.

So how's it work?

---
-Sean



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: werikblack on Mar 31, '03 09:37:27PM

Use CTRL-D, "logout," or "exit." No quotes or commas for any of those commands, but I'm too lazy to write the HTML to make them look fancy. :)



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: logo on Apr 01, '03 02:22:20AM

If you are on Ethernet you may try WakeUp (http://www.coriolis.ch/article18.html).

You will need to know the Ethernet Address though...



[ Reply to This | # ]
errors with osascript
Authored by: jhouston on Mar 31, '03 01:03:18PM

If you're getting this error:


## Component Manager: attempting to find symbols in a component alias of type (regR/carP/x!bt)

Then try deleting this Toast VideoCD folder, that is, if you don't use Toast to burn video CDs...

/Library/QuickTime/Toast Video CD Support.qtx


--jesus



[ Reply to This | # ]
What, no "rm -rf /"?
Authored by: lectern on Mar 31, '03 01:26:06PM

I'm just kidding. For those who don't know what this does: DO NOT DO IT. It's a command to erase the root of the drive and everything in it (i.e. the whole boot partition).

Funny? Maybe, but only if you've ssh'ed into 127.0.0.1.



[ Reply to This | # ]
What, no "rm -rf /"?
Authored by: Accura on Apr 01, '03 03:37:42AM

i had a old 486 running FreeBSD 4.5 that i was going to format so i did rm -rf /, was very funny

---
"The time has come," the walrus said. "To talk of many things..."



[ Reply to This | # ]
What, no "rm -rf /"?
Authored by: calroth on Apr 03, '03 05:04:12AM

One of my friends decided to delete all the stuff on his computer the other day, as a precursor to reformatting. So he went for instant gratification and ran that command.

It started deleting stuff on a mounted NFS server (well, it probably didn't, since he didn't have the permissions). He panicked and stopped, and tried to unmount it. Unfortunately he had already deleted mount :-)



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: Hanji on Mar 31, '03 04:01:51PM
If you can install VNC on the victim's computer, you can also have a lot of fun by taking over their desktop and mouse :-D
OSXvnc supports launching the server from a shell, so you can launch it over SSH (You could probably even manage to install it entirely over ssh, although it could be tricky), so you can just launch it when you want and kill it when you're done.

[ Reply to This | # ]
Installing/starting vnc
Authored by: extra88 on Mar 31, '03 05:53:24PM

Installation should be easy, if you can SSH you can SFTP. I'm pretty sure all you need is OSXvnc-server which is installed in /usr/locall/bin by default. To start it, use this command:

/usr/local/bin/OSXvnc-server -rfbauth PASSWORD -rfbport 5900 -dontdisconnect -alwaysshared -nodimming &

where "PASSWORD" is the password you want to use when connecting with a VNC client. The switches after the "5900" are optional but the "&" is kind of important because it tells the command you're running to run in the background. Without the "&" OSXvnc-server runs in the foreground of your SSH session and you'll have to open a new one to do any other commands.



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: rbest on Mar 31, '03 04:01:54PM

Anyone know how to log out via the CLI?



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: dscottf on Mar 31, '03 04:26:13PM

>Anyone know how to log out via the CLI?

Sure, use top to find the PID of the loginwindow process, and kill it.

*WARNING* it logs out instantly, without saving



[ Reply to This | # ]
type "exit"
Authored by: grocer on Mar 30, '04 08:33:42AM

type "exit" at the prompt...

(for the benefit of late stragglers)



[ Reply to This | # ]
More fun with error messages
Authored by: grrl_geek on Mar 31, '03 08:34:28PM

Back when I was in high school, there was some guy who secretly installed some program on all the lab computers that would pop up a (fake) error dialog. His favorite was:

"The radiation shield on your Macintosh has failed. Please step back 5 feet"

---
~~~~~~~~~~~~~
Sinker sucker socks pants, apocryphal awry!



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: eno on Apr 01, '03 12:36:37AM

I don't think this is "fun", nor funny.

You just shouldn't do this kind of prank, and I don't think it should be published on macosxhints.



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: Accura on Apr 01, '03 03:43:02AM

Each to there own man, well actually each to rob's since he controls the site. just deal with it and hope people will use any admin access they get to help people and not kick them in the ass (see 'rm -rf /' above)

---
"The time has come," the walrus said. "To talk of many things..."



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: timrand on Apr 01, '03 03:58:24PM

I wish there was a way to reset the screen resolution. I can see that it would be quite funny to set the resolution to 640 x 480.



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: Virtual1 on Jul 30, '06 01:16:41PM

download cscreen. then do something like

cscreen -d 8

and pfft they are at 256 colors. you can change res also. I have not found a way to change to greyscale or do the "flip gamma tables" trick yet without logging them out. Force-changing to an illegal scan rate would be ... cruel.


---
I work for the Department of Redundancy Department



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: azguy on Apr 01, '03 06:32:57PM

Haha... Oh man this will be fun once my mom gets home.

Note that it works great if you combine commands. Here's the one I'll use!

Here's mine:

sudo osascript -e "set Volume 20" -e 'say "Hello Kathi. This is your iBook. I am so tired of you making me do so much work for you. Do it yourself, you stinkin human. I have never really had the courage to tell you this, but sometimes I get so tired of your shit. You keep pushing my buttons, you shove me in crowded bags, and you use the printer way too much. I just cant take it anymore. I cant go on living like this. Now I will turn myself off and I will erase all your data. If you would like me to continue being your slave perhaps you should re think how you treat me. Goodbye and have a happy Tuesday" using "Bruce"' -e 'say "Dum Dum Dum Dum Da Dum Dum Dum Dum Dum Dum" using "Bad News"' -e 'tell app "Finder" to sleep'



[ Reply to This | # ]
Unix Administration Clarification
Authored by: ktohg on Apr 04, '03 11:49:27AM

I just wanted to clarify a point of Unix Administration. This isn't anything to do with an joke or anything. but under Unix or a command line it is recomended to use shutdown instead of halt or reboot. shutdown is far more friendly allowing you to set a delay and a message that everyone can see in there terminals. (In fact halt and reboot call shutdown with a time of 'now'

shutdown now "Halting now just because"
shutdown -r 5 "Rebooting due to software update."

Now the users can close there editors and such before the system goes down.

I know this is probubly more for servers and such and is kinda insignifigant on Mac OS X. But OSX is Unix and all good Unix users should know.



[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: mathiasbynens on Nov 26, '09 03:59:00AM

Too bad most of these donít work on Snow Leopard :(



[ Reply to This | # ]