Intro: Different Ways to Connect to Your Mac Mini
Connecting to your mac mini while at home or away is crucial, especially if you don't have a keyboard mouse and monitor permanently attached. One piece of lingo we need to set straight deals with which computer we're talking about. I will always use "localhost" to refer to the computer that you are connecting to your mac mini. For me its generally my laptop that I use at work and I bring home. "Remotehost" is this case the mac mini. Its the computer you generally have to connect to.
There are countless ways to connect and each way provides different services and are great for different things. I'm only going to talk about the ones I use, but they are so handy that you will probably make great use of them as well.
This instructable talks about connecting to your mac mini with just a network connection. If you are copying files you might want to connect with either a network cable or a firewire cable.
We'll talk about file sharing between macs
Then we'll talk about screen sharing and screen sharing remotely.
We'll talk about SSH and SCP, which are used extensively in the later instructables in this group.
This part of a compendium. Check out the other parts at:
Step 1: File Sharing Between Macs
If you are copying a large number of files that don't reside in one folder, or if you'd like to easily cherry pick files from one computer to put on another then this is clearly the best way. File sharing either allows you to see the 'public' folders that the remotehost user chooses for file sharing, or it also allows you to see and write to all the remote users stuff if you have the login and password for that user. Unfortunately, this only really works if you're on the same network.
First you need to setup the 'remote host' for file sharing. Go to Apple Menu>System Preferences>Sharing. Click on File Sharing to activate it. If you want to add any public folders, which are available to other users go ahead and do that. Otherwise, if you just want your folders available to the people who know the login information for the remote user, then you can leave that part blank.
Click on options brings up a dialog for choosing the sharing protocol type. If you want to share files with windows users click on SMB, but again they'll need login information unless you make some folders 'public'.
If you're local host computer is a mac, then it should see the computer under 'Shared' in a new finder window (Command + N). If you don't see it in the finder window, click "all" in the lefthand column. If for some reason you removed this from your default window display, you can connect to server by going to "Go>Connect to Server" then pressing browse. This should bring up a list of computers that are sharing files. Click on your desired remotehost. It will, by default try to connect as a guest, if you don't have that enabled or you need more access, you can click "connect as" in order to login as a user on that computer. This means you need the login information for the user whose files you are trying to access.
Step 2: Screen Sharing Between Macs
Screen sharing is a simple included utility with macs that allows you to view and control another mac as if you were using it. You can't really move files using it, though. So if you need to run that computer as if you were physically connected to it, then this is the preferred method. You can basically do anything that one could normally do if they had a keyboard and monitor hooked up to that computer.
To setup screen sharing on your mac mini or remotehost, go to "Apple Menu>System Preferences>Sharing" on this computer. This time click on "Remote Management" to enable this feature. If you have multiple users on the remotehost, and don't want all of them gaining access from another computer, just click the "Allow access for>Only these users" option. Then click the plus sign to add in the ones you actually want access for. You can manage each others permissions seperately so that you can't do crazy things while plugged in from half way across the world - probably a good idea.
You should typically leave the privileges for all users blank. This way, only people with the correct login information for the user can do things there.
Using screen sharing is easy on a local network. In the finder goto "Go>Connect to Server". Then in the dialog, type "vnc://remotehost_ip", where remotehost_ip is the local static ip address of your computer. See the instructable about setting up your mac mini.
This is another reason why it is helpful to give this computer a dedicated address on your local network.
You can also browse to the remotehost in the finder and then click on "share screen". Then authenticate and you're in!
Step 3: SSH - Secure Shell
Thats right, ssh stands for Secure Shell, how boring. Chances are (guaranteed if you installed developer tools) you have openssh installed. Its a great utility for securely connecting to other computers. There is a lot of information to implementing SSH if you've messed with stuff. If you haven't and its left at its default its pretty straight forward to use. So lets assume you are starting from the beginning.
SSH allows you to access the remotehost through the command line (aaack Terminal). Its akin to using screen sharing, except you're running through the command line and you can't see what anyone else is doing.
Just like everything else, you need to tell your mac you want to use SSH. On your remotehost (mac mini) go to "System Preferences>Sharing" and enable "Remote Login".
Now on your localhost computer, open terminal and type the following
Substitute remoteuser with the user you want connect as on to the remotehost. Likewise, substititute remotehost with the actual local IP address, or if you're connecting from elsewhere, use the registered domain address.
If you've never connected before, it will prompt you about an RSA fingerprint. Basically it just says it can't recognize the computer you're trying to connect to because you've never connected to it before. If you're sure about this, confirm with a y or yes. If you ever change the computer or ethernet card that the computer uses, it will come up with another one saying the fingerprint has changed, and it won't let you connect. If you're the one who changed the computer, then you can remove the old entry from /Users/locasuser/.ssh/Known_hosts, otherwise beware something is up! It starts out with the associated IP address and should be a few lines long. I would post a picture, but I have a feeling that information could be used against me.
Interesting variants on SSH:
SSH has a lot of options, for example you can use SSH to connect screen sharing (see next step)
ssh remoteuser@remotehost -L 5900:localhost:5900
To tunnel your shared music from elsewhere (see associated instructable)
ssh -g remoteuser@remotehost -L 3689:localhost:3689
Step 4: Using Screen Sharing Remotely!
As mentioned in the last step, its possible to connect with screen sharing across the interweb. Its pretty intolerable if either internet connection is slow, but take what you can get.
From the Terminal Command line, type the following
ssh remoteuser@remotehost -L 5900:localhost:5900
and replace remoteuser with the user you want to connect as, and then replace remotehost with the computer you are trying to connect to. You can leave localhost as 'localhost'. It knows what to do.
Then when you want to screen share, just go to the finder and click on "Go>Connect to Server" and type in
and press return. It should figure out what it needs to and ask for authentication.
If it doesn't work, go back to the terminal and make sure the ssh command worked as it should. You should be connected as if you made a regular ssh connection to the remotehost.
Step 5: SCP
SCP is a great command line utility for copying stuff from one computer to another. Its fast and works great if you know exactly where the files are. Furthermore, it limits the damage you can do by inappropriate copying of files.
The command works like this
SCP target destination
where target is the target file to be copied, and destination is the place its to be copied to.
Target and destination can look like either of the following
So you can copy from or to either computer from the other one. The remotehost needs a user to connect as and you can only write to where that user has permissions to write. So a common habit of mine is to always copy to :~/ then I ssh into the remotehost and do any other necessary moving of files later and sudo as root if absolutely necessary. If sudo as root is completely foreign to you, then you probably shouldn't google it to see what that means.
If you want to copy multiple files, use the -r or -R flag.
scp -R /foldername/ remoteuser@remotehost:~/foldername/
THis will copy the contents of foldername to the destination folder. Use the following if you want to also copy the folder as well
scp -R /foldername remoteuser@remotehost:~/foldername/
Do you see the difference? One includes the forward slash, the other doesn't. A subtle difference that could save you lots of headache later.