Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,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.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[60,631 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 whomever posted them. This site is not responsible for what they say.
Having fun on April 1st with SSH
Authored by: tjormola on Mon, Mar 31 2003 at 11:22AM PST
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 Mon, Mar 31 2003 at 11:32AM PST
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 Mon, Mar 31 2003 at 11:45AM PST
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 Mon, Mar 31 2003 at 11:29AM PST
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 Mon, Mar 31 2003 at 11:43AM PST
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 Mon, Mar 31 2003 at 12:11PM PST
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 Mon, Mar 31 2003 at 8:56PM PST
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 Tue, Apr 1 2003 at 11:00AM PST
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 Mon, May 19 2003 at 5:14PM PDT
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 Mon, Mar 31 2003 at 9:37PM PST
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 Tue, Apr 1 2003 at 2:22AM PST
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 Mon, Mar 31 2003 at 1:03PM PST
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 Mon, Mar 31 2003 at 1:26PM PST
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 Tue, Apr 1 2003 at 3:37AM PST
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 Thu, Apr 3 2003 at 5:04AM PST
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 Mon, Mar 31 2003 at 4:01PM PST
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 Mon, Mar 31 2003 at 5:53PM PST
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 Mon, Mar 31 2003 at 4:01PM PST
Anyone know how to log out via the CLI?

[ Reply to This | # ]
Having fun on April 1st with SSH
Authored by: dscottf on Mon, Mar 31 2003 at 4:26PM PST
>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 Tue, Mar 30 2004 at 8:33AM PST
type "exit" at the prompt...

(for the benefit of late stragglers)

[ Reply to This | # ]
More fun with error messages
Authored by: grrl_geek on Mon, Mar 31 2003 at 8:34PM PST
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 Tue, Apr 1 2003 at 12:36AM PST
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 Tue, Apr 1 2003 at 3:43AM PST
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 Tue, Apr 1 2003 at 3:58PM PST
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 Sun, Jul 30 2006 at 1:16PM PDT
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 Tue, Apr 1 2003 at 6:32PM PST
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 Fri, Apr 4 2003 at 11:49AM PST
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 Thu, Nov 26 2009 at 3:59AM PST
Too bad most of these don’t work on Snow Leopard :(

[ Reply to This | # ]