Tech Help Blog

A Technical Support Blog

Browsing Posts in Desktop Tech Help

From time to time it is necessary to update the hosts file on a machine, and MAC’s are no different! given they are based on unix most bits and pieces are in their usual places but “hidden” from the usual users. With good cause! If your reading this your obviously not a normal user…

So lets begin.

  1. Open Terminal and gain elevated privileges
    Click on Applications >> Utilities >> Terminal then enter the below command to gain elevated privileges.

    sudo su

    you will need to provide your root password at the prompt see below, typing the password will be blind.

  2. Enter and edit the hosts file as below.
    Enter the below command to edit the hosts file

    pico /etc/hosts

    Once in pico you will see something like the below screen shot.

  3. Once done save!
    Once you’ve finished editing the file as required hold Control and hit O then Enter, then Control and hit X to exit, and you’re done! Exit Terminal.

Job done! It isn’t difficult, however you need to use the sudo su command to gain root privileges before you will be able to successfully save the hosts file. For more information on Hosts Files check out this wiki link.

Rating 3.00 out of 5

OK, so if you’re like me your a bit of an all rounder, you will almost certainly come up against a MAC in your travels! While I used to cringe when I got the “ohh while you are here, the designers MAC has been playing up” line, now I am joyed by this as it tends to give a challenge! And for those of us who have embraced the world of MAC OSX we realise that its not all bad…

So in this little post I’ll be demonstrating how to use Terminal to mount an SMB (windows share) to a folder. Firstly there is the basic method of “Connect to Server” from the Finder >> Go >> Connect to Server option, see image left.. While I regularly use this method it simply mounts the share as a browse-able network share failing to actually “mount” it to a folder on your Mac drive. To briefly cover this Connect to Server option, simply select the connect to server option then type in smb://serveraddress/share and hit connect, its that simple.

My Mount option is a little more tricky however it enables the ability to say use a SMB share for all of your iTunes music, or work from a SMB/Windows share. Of great benefit is utilizing this as a logon script to enable a user in a predominantly Windows environment to have an equivalent to “mapped network drives” on their mac.

  1. Open up Terminal and mount mount mount!
    Head to Applications >> Utilities >> Terminal and follow the below sample to create a folder to mount to in your home directory and to mount your share to said folder. Note you can create the folder wherever you want.

mkdir ./sharemount

The below will mount your smb share to the folder we just created!

mount_smbfs //username:password@serverip/share ./sharemount

Ensure that the user account you will use to access this share has the correct permissions on the share and the folder (inherited down) on the windows server or you will mount but have issues accessing files.

Unfortunately this method will only mount for the session and a restart will require the command to be run again (not the mkdir bit! just the mount_smbfs bit) I find the best way is to create a script and then have it launch when the user logs in.

NOTES: I’ve noticed some occasions where windows server might have restarted or the MAC went to sleep and didn’t re establish correctly, for this I usually simply eject the server in Finder by clicking the little eject button to the right of the server in finder and then run the script again to reconnect the shares. Perhaps even leave a copy of the connect script you create on the desktop so the user can re establish before calling support!

Leave questions in the comments, thanks!

Rating 3.00 out of 5