Now we will need to update our Samba config. If you are already running RetroPie, you have already got Samba installed. If not, you may need to run the following command:
sudo apt-get install samba samba-common-bin
Before you edit your Samba config, make a quick backup copy of the current file.
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
Now, jump into the config file.
sudo nano /etc/samba/smb.conf
We are going to want to jump straight to the bottom of this file.
Once you get to the bottom, you should see a list of familiar folders that RetroPie already shares (roms, bios, configs, and splashscreens). Create another section just below the last that looks like this:
[share]
comment = Share
path = "/media/USBHDD/share"
writeable = yes
guest ok = yes
create mask = 0777
directory mask = 0777
force user = pi
The name and the comment can be customized, but make sure your path matches the one you created earlier.
And finally, you will want to restart your Samba daemons.
sudo systemctl restart smbd