This bash script is designed to run on Ubuntu-Server 22.04/24.04 with Samba-Service installed and Samba-Shares configured and resolves the issue of Samba share connections appearing as old CRT monitor icons in macOS Finder. It provides a straightforward solution to ensure proper icon representation for Samba share connections when accessed from macOS.
BEFORE:
If you want to access your Ubuntu Server (SMB-shares) from an Apple device running macOS and you click on “Network” in the Locations section of the macOS Finder sidebar, you may notice an unattractive CRT monitor icon displayed as your Ubuntu Server. In some cases, your Ubuntu Server might not be displayed at all.
AFTER:
This script will address this issue "not a bug" by installing Avahi (essentially Apple’s Bonjour) allowing you to log in by hostname and browse shares in macOS Finder. Additionally, this script will create a new smb.service configuration file in /etc/avahi/services/ directory in order to assign the correct server icon for macOS.
- Package Update and Upgrade: The script begins by updating and upgrading the system packages to ensure all software is up-to-date.
- Avahi Service Installation: Installs the Avahi service, which is essential for network discovery and service advertisement.
- Avahi SMB Service Configuration: Creates and configures a new
smb.service
file in the/etc/avahi/services/
directory. This configuration assigns the correct icon to the Ubuntu server when viewed in macOS Finder. - Ownership and Permissions Adjustment: Changes the ownership and permissions of the
smb.service
file to allow future modifications, ensuring flexibility in changing the icon if needed.
- Ubuntu Server 22.04/24.04
- Bash
- Run script as root
- Input username as $1 parameter
Clone the repository:
git clone https://github.com/projects-by-ac/fix-macos-samba-server-icon.git
Navigate to the script directory:
cd fix-macos-samba-server-icon
Make the script executable:
sudo chmod +x fix-macos-smb-icon.sh
Run the script with username as $1 parameter:
(example running script with 'test1' as username)
sudo ./fix-macos-smb-icon.sh test1
This appears to be the sole solution to this problem thus far...
-
For more in-depth information about this issue, please refer to the following articles: