System Preferences | Sharing | Computer Name

jcshofner
New Contributor III

So, In JSS I added a Configuration Policy that displays a banner on the log in screen. This is working fine, however, when I go to System Preferences | Sharing, the Computer Name is grayed out. I cannot change the computer any longer. I was able to change the computer name before the banner configuration policy was deployed. I have seen some discussions as to creating a policy to reset computer name. This does not work. Is there anyway to enable the Computer Name without disabling the banner configuration policy.

5 REPLIES 5

blackholemac
Valued Contributor III
sudo scutil —set HostName $namehere
sudo scutil —set LocalHostName $namehere
sudo scutil —set ComputerName $namehere

For syntax purposes above use two dashes

You could define $namehere before these lines by calling a simple AppleScript that asks the user to supply a string.

If you want to make it easy for users to run, set your finished script as a self service policy

ammonsc
Contributor II

We had a script that allowed a user to change the computer name in Self Service.

#!/bin/bash

NewComputerName="$(osascript -e 'Tell application "System Events" to display dialog "Enter the Asset ID Number:" default answer ""' -e 'text returned of result' 2>/dev/null)"

jamf setComputerName -name "$NewComputerName"

jamf recon -assetTag "$NewComputerName"

jcshofner
New Contributor III

So, there is not a single checkbox option in JSS to enable Sharing | Computer Name? Why does the Computer Name become disabled in the first place? Is it a bug?

easyedc
Valued Contributor II

So I used to do this many, many OS's ago in order to unlock time zone control for users while still locking things like which time server to hit. Check if

security authorizationdb

is still applicable to do this for you. In my use, it was

#!/bin/sh
security authorizationdb write system.preferences allow
security authorizationdb write system.preferences.datetime allow
exit 0

All you have to do is find the correct name to grant rights. The man page is pretty self explanitory

$ security authorizationdb
Usage: authorizationdb read <right-name>
       authorizationdb remove <right-name>
       authorizationdb write <right-name> [allow|deny|<rulename>]
If no rulename is specified, write will read a plist from stdin.
       authorizationdb merge source [destination]
If no destination path is specified, merge will merge to /etc/authorization.
       authorizationdb smartcard <enable|disable|status>
Enables/disables smartcard login support or report current status.
        Make changes to the authorization policy database.

blackholemac
Valued Contributor III

Once file sharing is turned on it can be assumed you have live connections...that’s why you don’t change names in the GUI unless turned off