How to quit the graphical OS from another Mac ?

Pascal

Official visitor
I have 2 Macs linked together with an ethernet link.

One of my Mac is presently stuck : the screen saver is on and I have a magnificient rainbow cursor that has been turning if front of my face for about an hour now. (I have not been siting there for an hour, mind you !!!) Of course, I am starting to understand that the screen saver has somehow crashed... ;) I also know that this doesn't mean that the whole OS is crashed (this is a UNIX OS after all...).

I have read that it is possible to access the computer from another Mac to kill the offending process. But I don't know how... Could anyone explain it to me ???
 
First thing to ask is: do you have your machine set up for remote login?

If you do then you just need to ssh into the problem machine and kill what ever app is causing the problem. Here is an example
Code:
$ ssh 10.0.0.24
This will ssh to the machine who's ip you specify. This command needs there to be a account on the target machine that is the same name as the account you are using on the machine you are ssh'ing from. If you want to use a diffrent account (i.e. you have named your admin something diffrent on the target machine) you need to use the '-l' switch like so:
Code:
$ ssh -l foo 10.0.0.24
Once you are in you need to figgure out what is the problem app, which can usualy be done by issuing a 'top -u' and seeing what is using most of the cpu time. Once you know what you need to kill you can kill it.
Code:
$sudo kill -9 <pid>
This will kill the app whose pid you specifiy. The PID is the Process ID and you can get that from the listing in top.
 
I type :
Code:
ssh 10.0.0.24
And I get the reply :
Code:
Secure connection to 10.0.0.24 refused.
(of course, I type the correct IP of my computer ! ;) I have turned the "Activate FTP access" option "on" in the Sharing preference pane, and I have the same login on both Macs...)

Is there something else I should do ? What am I doing wrong ? Anyway, it doesn't work !!! :(
 
The option you are looking for is under the Application pane of the Sharing Prefs.

That enables ssh. FTP only enables the ftp server so you can ftp to your machine and get files off of it or put files on it. Unfortunaly it won't let you control the computer through ftp.
 
Oops ! :eek:

After activating the correct services, it worked !

(of course I had long restarted my Mac, but I will know for the future... if I can remember those voodoo incantations ! ;) )

Still, I have another question : Terminal complained that :
Code:
The authenticity of host '10.0.0.24 (10.0.0.24)' cannot be established.
RSA key fingerprint is (long string was here).
Are you sure you want to continue connecting (yes/no)?
Why is that ? Is it normal ? This warning did not prevent me to continue (I typed yes), but still... I don't like this warning, it just doesn't feel right !
 
I forgot to say (and vBulletin denies me the right to edit my post) : could this message be because my two computers have the same login, but not the same password ?
 
Why does it take so long for the other computer to answer to the initial ssh request (at least 1 minute) ? Is it normal or is there something fishy ?
 
That is a normal response for the first time connecting to a server. What is is saying is that it has never seen this server's crypto key before and so it is asking you if you trust that this is realy the server. It shouldn't ask again.

As for the delay in connecting initialy, its normal on OS X, im not sure why but ssh'ing into a mac os X box can take forever to do the initial connect. Once you are connected its speedy though.
 
Originally posted by LordOphidian
As for the delay in connecting initialy, its normal on OS X, im not sure why but ssh'ing into a mac os X box can take forever to do the initial connect.
Something to improve for Mac OS 10.2, I guess ! ;)

Thank you very much for your many replies (and patience) : I appreciate it a lot !
 
Hi,
in regards to the warning you got that is normal, it is just that the first machine doesn't "know" the other. Next time you connect you won't get the warning, unless something odd happens and your ssh key changes, don't worry about it.

The second issue about the time it takes to connect, I belive that it is due to the machine trying to do a reverse dns lookup. ie trying to asociate the ip 10.0.0.24 to a name.

for example on my network:
10.10.10.10 is called lucretia (this is my linux box)
10.10.10.3 is dominion (this is the mac os x box)
and so on, when one tries to ssh from lucretia to dominion, there is a delay as dominion, tries to find out the name for 10.10.10.10 and fail.

There is a workaround, but it isn't fun, one needs to set up a dns server configured to do reverse lookups. and setting this up is a bit out of the scope of this message.

If you want to do this, have a look on www.linuxdoc.org for a dns HOWTO, there is heaps of good info there for Linux which can be applied to Mac OS X.

Benjamin
 
Naa naa naa... just enter into both computers the both computer's names and ip's in a host file.

use netinfo, or nidump/niload with an /etc/hosts file.

As for screensavers, I've had the basic screen saver (Apple logo and comp name) crash on me with the rainbow cursor ( waited +10mins for the password dialog). I tried to ssh to my comp, but didn't get a login prompt (guessing cpu usage was at a premium).

I'd love to know what caused that one!
 
Originally posted by kilowatt
Naa naa naa... just enter into both computers the both computer's names and ip's in a host file.

use netinfo, or nidump/niload with an /etc/hosts file.
Could you explain how to do this, step by step ? :)
As for screensavers, I've had the basic screen saver (Apple logo and comp name) crash on me with the rainbow cursor ( waited +10mins for the password dialog). I tried to ssh to my comp, but didn't get a login prompt (guessing cpu usage was at a premium).

I'd love to know what caused that one!
Well I can't tell you why it happens, but I can tell you that :
  • if you wait long enough, you will finally get into you Mac via ssh and be able to kill the ScreenSaver
  • trashing the screen saver prefs and plist (in ~/Library) definitely solved that problem for me... These old tricks : they always work ! ;)
    [/list=a]
 
Originally posted by kilowatt
Basically, authenticate yourself, and create an entry like this (...)
I'm not sure I understand what each part of the router entry means. Well, ok, I admit it : I don't understand at all. :p

Of course, there's the IP. That part at least I understand. :D

But the other part, underneath : why did you have to create 2 entries ??? Say one of my computer is named Courvoisier : does this mean I should have 2 entries : "Courvoisier" and "Courvoisier.localdomain" ?

And why is it called "localdomain" instead of "localhost" ?

Please explain to this poor little fellow here... :(
 
if you don't have a real domain, I usually place all my hosts under localdomain.

like router.localdomain, mach.localdomain, slowboze.localdomain, etc. I don't know if I should, but I've been doing it for years ;-)

I'll post some detailed information tomarrow on how to netinfo this stuff, as well as how to cli it in.
 
Ok, here it is, the step by step instructions for adding hosts to the netinfo hosts list.

Way number 1: The Terminal method.

step 1, load up the terminal application.
step 2, become root (su, or sudo -s).
step 3, create a file in /etc called 'hosts'.
pico /etc/hosts
Now you are in pico, the easy to use unix text editor. Make a standard unix hosts file
127.0.0.1 localhost.localdomain localhost
192.168.1.32 oldcomp.localdomain oldcomp
192.168.1.25 cartman.localdimain cartman

If there is some stuff already in the file, don't worry about it, just add to it.

Now, save the fole (control-o, press enter), and exit pick (control-x)

Now we have to load the hosts into netinfo:

crap, gota go. more to come
 

And why is it called "localdomain" instead of "localhost" ?

Its called localdomain because its the domain part of the host name. When you see localhost in Unix its actually an alias (if things are set up in a sane manner) to localhost.localdomain. If you have changed your computers hostname, to say, ophid, it would be ophid.localdomain.
 
I should mention that localhost.localdomain is still valid even if you have changed your hostname, it is simply a generic and constant way of addressing your computer.
 
Oh, dude, sorry about that.
Allrighty, here is the netinfo method, because I can't get the cli to do it.

Launch netinfo.
Under the Domain menu, select Security, and Authenticate. Type a username and password with admin prividledges.

Select, in the Directory Browser, / and then 'machines'.

Either press apple-n, the icon that looks like 'new folder' or go to the Directory menu, and select 'new sub directory'.

This should insert a flag at /machines/net_directory

Unless you are creating an entry for a host named 'new_directory' you'll want to rename it.

Select, in the 'Directory: new_directory' plane that has 'property and Value(s)' stuff the first, and only entry ("name | new_directory").

Under the 'Directory' menu, select 'Delete value'.

The entry should now read 'name | <no value>'. Which is good.

Now, enter the hostname, which can be something simple like myfileserver or as 'complex' as files.danz.quons.net or whatever.

So, select the name and <no value> line, and go to the directory menu, and select 'insert value'. (option-apple-i)
Now type the hostname.


Next, we need to input an ip address.

First, insert a new property, called 'ip_address'.
apple-shift-n or apple-shift-i (eye - look in the directory menu, you'll see it).

where it says 'new_property', click and type 'ip_address'.

Where it says 'new_value', type the ipaddress that goes with the host you inserted.

If you wish, you can enter more than one hostname, so if for example you wish matrixbaby.graphics.ddn.net and matrixbaby both to go to the same IP, just insert an additional value to the name property:

Select 'name' and under, the 'directory' menu, select 'insert value' (apple-option-i).

That should do it, close out of netinfo, and you're set. If you wish to properly name your computer, either insert/modify the entry called 'localhost' and give it a name, in addition to localhost. I think thats what I did. you can also modify the /etc/hostconfig file, change the HOSTNAME= localhost to whatever you wish.

I hope this clears things up, and please ask if you have any more questions.

Once again, I'm sorry about the extreme delay in my postings... college keeps me very busy!
 
Back
Top