Get hostname mac os

Определение имени и сетевого адреса компьютера на Mac

Чтобы другие пользователи могли найти Ваш Mac в сети, им необходимо знать его имя или сетевой адрес. Поиск компьютера Mac в сети возможен по нескольким идентификаторам: имя компьютера, локальное имя хоста (или локальное сетевое имя) и сетевой адрес.

Определение имени компьютера

Если Вы включили общий доступ к экрану или файлам Вашего компьютера, пользователи Вашей сети могут найти Ваш Mac по его имени.

На Mac выберите пункт меню «Apple»

> «Системные настройки», затем нажмите «Общий доступ».

Имя компьютера Mac отображается в верхней части настроек общего доступа.

Определение локального имени хоста компьютера

Локальное имя хоста (или локальное сетевое имя) Вашего компьютера отображается в Вашей локальной сети, позволяя другим пользователям сети подключаться к Вашему компьютеру Mac. Оно также идентифицирует Ваш Mac в других приложениях и службах, совместимых с Bonjour.

На Mac выберите пункт меню «Apple»

> «Системные настройки», затем нажмите «Общий доступ».

Локальное имя хоста компьютера отображается под именем компьютера в верхней части настроек общего доступа.

Локальное сетевое имя представляет собой имя компьютера с добавлением .local на конце. Если имя компьютера содержит пробелы, то они заменяются дефисами (-). Например, если имя Вашего компьютера My Computer, то локальное сетевое имя будет My-Computer.local. Локальные сетевые имена не зависят от регистра, поэтому имена my-computer.local и My-Computer.local эквивалентны.

Определение сетевого адреса компьютера

Если Вы предоставляете доступ к своему экрану или файлам, разрешаете удаленный вход или управление, для доступа к этим службам другим пользователям может понадобиться знать не имя, а сетевой адрес Вашего компьютера.

На Mac выберите пункт меню «Apple»

> «Системные настройки», затем нажмите «Общий доступ».

В списке слева выберите службу с установленным флажком «Вкл.».

Сетевой адрес компьютера отображается справа. Например:

Если Вы выбрали «Общий экран», сетевой адрес имеет следующий вид: vnc://10.212.167.33 или vnc://name.example.com.

Если Вы выбрали «Общий доступ к файлам», сетевой адрес имеет следующий вид: smb://10.212.167.33 или smb://name.example.com.

Если Вы выбрали «Удаленный вход», сетевой адрес имеет следующий вид: username@10.212.167.33 или username@name.example.com.

Если Вы выбрали «Удаленное управление», сетевой адрес имеет следующий вид: 10.212.167.33 или name.example.com.

Сетевой адрес компьютера предоставляется сервером DNS, который использует Ваш компьютер. Если Вы не используете службу DNS, сетевой адрес является производным от имени Вашего компьютера.

Источник

Question: Q: Where does OS X get the $HOSTNAME from?

I bought a MacBook from a friend. I then changed the old HD with a new SSD and the RAM as well.

I made an USB Key with OS X El Capitan installer from my old MacBook Pro running Mac OS X 10.6 Snow Leopard and then I installed El Capitain on the MacBook. I made a fresh installation and I didn’t restore any data from Time Machine etc.

In System Preferences / Sharing I see as computer name » Manuel’s MacBook » and I read » Computers on your local network can access your computer at: ManuelsMacBook.local «

BUT

If I open a terminal the prompt says » MyFriendName-MacBook:

How is this possible? Where does OS X get the hostname of my MacBook from?

I attach the output of the following commands, hoping can be useful to someone that will answer my question:

Manuel$ echo $HOSTNAME

MacBook, OS X El Capitan (10.11.3), null

Posted on Jan 31, 2016 4:38 AM

sudo scutil —set HostName whatever-you-want

If that doesn’t work, the hostname is being set to the result of a reverse lookup of your IP address on a local DNS server, most likely your gateway.

Читайте также:  Просмотрщик картинок для linux

Posted on Jan 31, 2016 12:03 PM

All replies

Loading page content

Page content loaded

System Preferences — Sharing

Jan 31, 2016 4:51 AM

I’m sorry, but as you can read in my original post, the system preferences / sharing, there is a different string (the correct one).

Jan 31, 2016 5:00 AM

The Macbook is probably still registered on your friend’s name. See this info for some background: What to do before selling or giving away your Mac — Apple Support

Jan 31, 2016 5:04 AM

I’ll ask him to check on supportprofile.apple.com but still. this means OS X has downloaded from somewhere since I changed the HDD with a new SSD.

Jan 31, 2016 5:10 AM

Before acquiring a second-hand computer, you should have run Apple Diagnostics or the Apple Hardware Test, whichever is applicable.

The first thing to do after acquiring the computer is to erase the internal drive and install a clean copy of OS X. You—not the original owner—must do that. Changes made by Apple over the years have made this seemingly straightforward task very complex.

How you go about it depends on the model, and on whether you already own another Mac. If you’re not sure of the model, enter the serial number on this page. Then find the model on this page to see what OS version was originally installed.

It’s unsafe, and may be unlawful, to use a computer with software installed by a previous owner.

1. If you don’t own another Mac

a. If the machine shipped with OS X 10.4 or 10.5, you need a boxed and shrink-wrapped retail Snow Leopard (OS X 10.6) installation disc from the Apple Store or a reputable reseller— not from eBay or anything of the kind. If the machine is very old and has less than 1 GB of memory, you’ll need to add more in order to install 10.6. Preferably, install as much memory as it can take, according to the technical specifications.

b. If the machine shipped with OS X 10.6, you need the installation media that came with it: gray installation discs, or a USB flash drive for a MacBook Air. You should have received the media from the original owner, but if you didn’t, order replacements from Apple. A retail disc, or the gray discs from another model, will not work .

To start up from an optical disc or a flash drive, insert it, then restart the computer and hold down the C key at the startup chime. Release the key when you see the gray Apple logo on the screen.

c. If the machine shipped with OS X 10.7 or later, you don’t need media. It should start up in Internet Recovery mode when you hold down the key combination option-command-R at the startup chime. Release the keys when you see a spinning globe. Note that Mac Pro tower models older than late 2014 (with the «cheese-grater» enclosure) cannot use Internet Recovery, regardless of which OS version they shipped with. The round Mac Pro (2014 or later) can use it.

d. Some 2010-2011 models shipped with OS X 10.6 and received a firmware update after 10.7 was released, enabling them to use Internet Recovery. If you have one of those models, you can’t reinstall 10.6 even from the original media, and Internet Recovery will not work either without the original owner’s Apple ID. In that case, contact Apple Support, or take the machine to an Apple Store or another authorized service provider to have the OS installed.

Читайте также:  Современные языки программирования для windows

2. If you do own another Mac

If you already own another Mac that was upgraded in the App Store to the version of OS X that you want to install, and if the new Mac is compatible with it, then you can install it. Use Recovery Disk Assistant to prepare a USB device, then start up the new Mac from it by holding down the C key at the startup chime. Alternatively, if you have a Time Machine backup of OS X 10.7.3 or later on an external hard drive (not a Time Capsule or other network device), you can start from that by holding down the option key and selecting it from the row of icons that appears. Note that if your other Mac was never upgraded in the App Store, you can’t use this method.

3. Partition and install OS X

a. If you see a lock screen when trying to start up from installation media or in Recovery mode, then a firmware password was set by the previous owner, or the machine was remotely locked via iCloud. You’ll either have to contact the owner or take the machine to an Apple Store or another service provider to be unlocked. You may be asked for proof of ownership.

b. Launch Disk Utility and select the icon of the internal drive—not any of the volume icons nested beneath it. In the Partition tab, select the default options: a GUID partition table with one data volume in Mac OS Extended (Journaled) format. This operation will permanently remove all existing data on the drive .

c. An unusual problem may arise if all the following conditions apply:

OS X 10.7 or later was installed by the previous owner

The startup volume was encrypted with FileVault

You’re booted in Recovery mode (that is, not from a 10.6 installation disc)

In that case, you won’t be able to unlock the volume or partition the drive without the FileVault password. Ask for guidance or see this ASC discussion.

d. After partitioning, quit Disk Utility and run the OS X Installer. If you’re installing a version of OS X acquired from the App Store, you will need the Apple ID and password that you used. When the installation is done, the system will automatically restart into the Setup Assistant, which will prompt you to transfer the data from another Mac, its backups, or from a Windows computer. If you have any data to transfer, this is usually the best time to do it.

e. Run Software Update and install all available system updates from Apple. To upgrade to a major version of OS X newer than 10.6, get it from the Mac App Store. Note that you can’t keep an upgraded version that was installed by the original owner. He or she can’t legally transfer it to you, and without the Apple ID you won’t be able to update it in Software Update or reinstall, if that becomes necessary. The same goes for any App Store products that the previous owner installed—you have to repurchase them.

a. If the original owner «accepted» the bundled iLife applications (iPhoto, iMovie, and Garage Band) in the App Store so that he or she could update them, then they’re irrevocably linked to that Apple ID and you won’t be able to download them without buying them. Reportedly, Mac App Store Customer Service has sometimes issued redemption codes for these apps to second owners who asked.

Читайте также:  Windows update newest version

b. If the previous owner didn’t deauthorize the computer in the iTunes Store under his Apple ID, you wont be able to authorize it immediately under your ID. In that case, you’ll either have to wait up to 90 days or contact iTunes Support.

c. When trying to create a new iCloud account, you might get a failure message: «Account limit reached.» Apple imposes a lifetime limit of three iCloud account setups per device. Erasing the device does not reset the limit . You can still use an iCloud account that was created on another device, but you won’t be able to create a new one. Contact iCloud Support for more information. The setup limit doesn’t apply to Apple ID accounts used for other services, such as the iTunes and Mac App Stores, or iMessage. You can create as many of those accounts as you like.

Источник

Change your computer’s name or local hostname on Mac

Your computer’s name and local hostname are used to identify your computer on your local network.

Change your computer’s name

Your computer’s name is displayed at the top of the Sharing preferences pane.

On your Mac, choose Apple menu

> System Preferences, then click Sharing.

If the lock at the bottom left is locked , click it to unlock the preference pane.

Type a new name in the Computer Name field.

Change your computer’s local hostname

The local hostname or local network name, is displayed beneath the computer’s name at the top of the Sharing preferences pane. It identifies your Mac to Bonjour-compatible services.

The local hostname is your computer’s name with .local added, and any spaces are replaced with hyphens. For example, if your computer’s name is My Computer, your local hostname is My-Computer.local. Local hostnames aren’t case sensitive, so my-computer.local is the same as My-Computer.local.

On your Mac, choose Apple menu

> System Preferences, then click Sharing.

If the lock at the bottom left is locked , click it to unlock the preference pane.

Click Edit, then enter a new local hostname.

If your Mac has the exact name of another Mac on your local network, a number is added to the local network name.

Источник

linux-notes.org

Имя хоста — это символическое имя, присвоенное сетевому устройству, которое может быть использовано для организации доступа к этому устройству различными способами. Такое имя присваивается каждому устройству, выходящему в сеть. То есть сетевое имя можно определить не только у персонального компьютера, но и у ноутбука, планшета, смартфона, кпк и даже холодильника, если он подключен к интернету. По имени хоста можно предположительно определить ваш регион и интернет оператора. Если у вас динамический ip адрес, то и имя компьютера будет меняться при каждом новом интернет соединении.

Изменить hostname/ComputerName/LocalHostName в Mac OS X

Для начала (если кто-то не знает свой hostname), выполним следующую команду для того, чтобы узнать hostname:

Как видно с вывода, у меня — Macbook, но я могу изменить на любой другой с помощью команды:

Можно более детально ознакомиться с этой командой прочитав man:

Так же, поддерживается синтаксис как и в Unix/Linux и можно выполнить следующую команду:

Она тоже сменит ваш хостнейм.

Можно изменить имя компьютера:

Так же, с легкостью, можно изменить локальный хостнейм:

Очистите DNS кэш:

На этом, я завершаю свою статью «Изменить hostname/ComputerName/LocalHostName в Mac OS X».

Добавить комментарий Отменить ответ

Этот сайт использует Akismet для борьбы со спамом. Узнайте, как обрабатываются ваши данные комментариев.

Источник

Оцените статью