If you work with the RaspberryPi you will sooner or later encounter the problem of how to transfer files to the RaspPi or copy them from the RaspPi.
There are different ways to do that. An easy way is the transfer via FTP or SFTP.
When communicating with your Rasp Pi over the Internet, one of them is certainly your first choice. However, if you work in the home network, it is much more comfortable to exchange the files directly via Windows Explorer.
To make this possible you have to set up a share on the Rasp Pi, which you can then integrate under Windows as a network drive.
How to do that and what you should pay attention to in the following article.
Hints for our lovely english readers: Basically, many of the articles on Nerdiy.de are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section.
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂
I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/sicherheitshinweise/
Affiliate links / advertising links
The links to online stores listed here are so-called affiliate links. If you click on such an affiliate link and store via this link, Nerdiy.de receives a commission from the online store or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂
Before you start with this article, you should have prepared the RaspberryPi so far that it can be reached via the network and controlled by SSH.
The following three articles describe what to do to prepare the RaspberryPi:
RaspberryPi - Setting up for Nerdiys!
RaspberryPi - The First Configuration!
RaspberryPi - Control the RaspberryPi via SSH
Basics of navigation in Windows Explorer
In the following list you will find all the parts you need to implement this article.
Log in via SSH on the RaspberryPi
To get started, you first need to log in to RasPi with SSH on Putty. How to do it is described in the article
Update package management
The package management in Linux is a "central point" over which various software packages can be installed. For this to work reliably, the lists and sources of package management should be updated before installing any new packages.
sudo apt-get update && sudo apt-get upgrade
Install the required programs or packages
To be able to share a folder, you need of course a corresponding program called Linux package. The required package is called "Samba". You can install this "samba" with the following command:
sudo apt-get install samba
You confirm these demands with a "j"(or "y") and enter. The installation will then continue.
Create the folder to be shared
In order for you to be able to share access to a folder, you must first create a corresponding folder in your home directory.
This is done with the following command:
In the screenshot you can see the home directory before and after the folder "share folder" was created.
In the view of the home directory after creating the folder, the (red underlined) "Release Folder" will be available.
Customize the Samba configuration file
Now we have to tell "Samba" where the folder to be shared is and under what conditions we would like to release it. This can all be set in the Samba configuration file. This is called smb.conf. To edit them you need to execute the following command:
sudo nano /etc/samba/smb.conf
After opening the configuration file, you use the arrow keys to maneuver the cursor to the end of the file (ie all the way down). There you then insert the following configuration text:
[Pi release] comment=Raspi Sharepath=/home/pi/release folder browseable=Yes writeable=Yes only guest=No create mask=0740 directory mask=0750 public=no
It is easiest if you mark the text, copy it and then paste it into the text file with a right-click in the relevant place.
If you have chosen a different folder name or location for your shared folder, you will need to change the corresponding part under "path".
These configuration settings will allow you to have read and write permissions in the folder, to be able to browse it, and to allow only users who have previously logged in with username and password to access it.
In order to save the changes you have to press CTRL + X on the keyboard and confirm the request if you want to save before closing with a "j" (or "y"=yes) and ENTER.
This saved your recent changes to the configuration file.
Samba is automatically restarted and the new configuration is taken over.
Set up a user account
Since you have configured the sharing by the information in the configuration file so that only users with username and password can access them, we now have to create a username with a suitable password.
This user name is the same as the currently used Linux user. The password may be different from this.
For example, to create the user "pi" you need to execute the following command:
sudo smbpasswd -a pi
Set up network drive under Windows
With the configuration under Linux you are now finished.
Now you have to configure the shared folder in Windows as a network drive. You can then finally access the shared folder as if it were a local drive (that is, connected directly to your computer).
To configure this network drive, open the "Computer". So the window in which you also plugged USB sticks, CD/DVD drives and hard drives are displayed.
But you also have to tell Windows that it should use the user account that was created on the RaspberryPi.
Attention now it gets a bit complicated:
This is done by setting the user name, separate from a backslash (ie, the slash on the sharp s key on a germany keyboard layout), to the user's domain. The domain of the user in this case is your Rasp Pi.
Long story short:
So you do not just type in "pi" but
In my example, this would then be
The password is entered as normal in the password line.
Then you click on "OK".
The window then closes and a new window opens shortly thereafter.
This folder now shows you the contents of the shared folder on the Rasp Pi. All files that you now copied into this drive are copied directly to the Rasp Pi.
You now know how to share a folder on the Rasp Pi and connect it as a network drive on a Windows system.
Have fun with the project
I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂
P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate that I share this information with you, I would be happy about a small donation to the coffee box. 🙂
ich hatte gestern die Frage in den falschen Beitrag gestellt, sorry dafür.
Mein Problem ist, das, obwohl ich die externe HDD (3.5 “ mit eigener Stromversorgung) in OMV einbinden kann und auch unter Windows Freigaben bereitstellen kann, mir keine Dateien oder Ordner auf dem Netzlaufwerk angezeigt werden. Meldung: „Ordner ist leer“.
Eine andere externe SSD (Nvme mit Adapter) wird angezeigt und ich kann auf alle Dateien zugreifen.
Eigentlich kann es nur an der HDD oder dem Dateiformat liegen, oder liege ich hier falsch? Das Dateiformat der 3.5″ ist NTFS, das der kleinen BTRFS.
Was auffällig ist, unter Storage – Shared Folders wird unter Device bei den Nvme der übliche Pfad angezeigt:
/dev/sda, bei der großen der Partitionsname „Movies“ .
Der absolute Pfad, wird jedoch korrekt angezeigt. Hat jemand einen Tipp für mich was das Problem sein könnte. Das Tutorial ist klasse und ich habe es genauso befolgt, jedoch ohne Erfolg.
Achja, Windows verlangt beim erstellen des Netzlaufwerks keinen Benutzernamen und Passwort.
Danke euch schonmal.
so ad hoc habe ich keine direkte Idee. Es sollte eigentlich auch mit NTFS funktionieren.
Kannst du mir mal die ausgabe von dem Befehl „df -h“ hier rein kopieren, wenn die 3,5″ Festplatte angeschlossen ist.
Das sollte alle angeschlossenen Laufwerke inkl. deren Mountpoints auflisten. 🙂