Skip to content

Install Samba directly on Ubuntu

Jeremy Harris edited this page Aug 4, 2024 · 1 revision

To install Samba on Ubuntu and configure it so that you can mount it in Finder on a Mac, follow these steps:

Step 1: Install Samba on Ubuntu

  1. Update the Package List:

    sudo apt update
  2. Install Samba:

    sudo apt install samba

Step 2: Configure Samba

  1. Edit the Samba Configuration File:

    Open the Samba configuration file in your preferred text editor. For example, using nano:

    sudo nano /etc/samba/smb.conf
  2. Add a New Share:

    Scroll down to the bottom of the file and add your share definition. For example:

    [shared]
    path = /path/to/your/shared/folder
    available = yes
    valid users = your_username
    read only = no
    browsable = yes
    public = yes
    writable = yes

    Replace /path/to/your/shared/folder with the actual path to the folder you want to share, and your_username with your actual username.

  3. Save and Exit:

    • If using nano, save the file by pressing CTRL + O, then Enter, and exit with CTRL + X.

Step 3: Create a Samba User

  1. Add a User to Samba:

    sudo smbpasswd -a your_username

    Follow the prompts to set the Samba password.

Step 4: Restart Samba Service

  1. Restart the Samba Services:

    sudo systemctl restart smbd
    sudo systemctl restart nmbd

Step 5: Mount the Samba Share in Finder on Mac

  1. Open Finder and press Command + K or go to Go > Connect to Server.

  2. Enter the Samba Share Address:

    Enter the address in the format smb://[server_ip]/[shared]. For example:

    smb://192.168.1.100/shared
    

    Replace 192.168.1.100 with the IP address of your Ubuntu server and shared with the name of the share you defined in the Samba configuration file.

  3. Connect and Authenticate:

    Click Connect, then enter your Samba username and password when prompted.

Your Samba share should now be accessible in Finder on your Mac.

Additional Tips

  • Firewall Configuration: Ensure that your firewall allows Samba traffic. You can enable Samba-related services with:

    sudo ufw allow samba
  • Permissions: Make sure the directory you are sharing has the appropriate permissions for the Samba user to access.

For further details, you can refer to the official Ubuntu Samba documentation and Samba Wiki.