By default, your Raspberry Pi will not be availble to your network via its Hostname. You could access it via IP address, but that isn’t guaranteed to be static. You’ll also want to setup a file share so that you can code on your desktop machine and easily copy your code to your Pi…or work directly off the Pi via a network share.
You can do both (access via hostname and create a file share) with Samba.
Follow the instructions in my How to Remote Desktop into Raspberry Pi (Raspbian Stretch) with RealVNC post. This will allow you to remote into your machine from your Windows desktop.
- Go to Raspberry Pi Configuration -> System and set a unique Hostname and click OK.
- Click Yes to reboot the Pi
Open Terminal and run the following:
Scroll down to the Global Settings section:
- Set workgroup to the name of your workgroup or domain name
- Change ‘wins support’ from ‘no’ to ‘yes’
Scroll down to the bottom of the smb.config file and paste in the following:
This will share your entire home directory. If you’d like to limit access to a subdirectory, just create a directory and change the ‘path’ variable.
Open Terminal and execute the following to set the Samba password for the ‘pi’ user.
This password can be different than the regular Pi user password.
You’ll need to enter the password twice.
You can now remote into your Pi via hostname instead of IP. See this post for remote desktop instructions.
You can now access the file share you just created on your desktop machine
- Open Windows Explorer, type in your Pi hostname and you will see the share
I like to do this so I can easily access the files without having to type in the Hostname everytime.
- Right click on ‘This PC’ in Windows Explorer and select ‘Map network drive…’
- Enter path to Pi share and check ‘Connect using different credentials’
- Select ‘Use a different account’ and enter ‘pi’ and ‘raspberry’ (or whatever you set your Samba user/password to). Check ‘Remember my credentials’ so you don’t get prompted everytime you access the share.
- You will now be able to access the share via drive letter