This article describes how to build a file sharing server at home using Raspberry Pi.
Suppose your company distributes a Windows PC for remote work. Taking the designer as an example, if you want to copy the data on Windows distributed by your company to your Mac at home and work on it, you need some way to share files.
You can share files with online storage services such as Dropbox, but a convenient file sharing server is one that you can use at home.
By installing ** Samba ** on Raspberry Pi and building a file sharing server, you can easily share files on Windows and Mac.
SMB ** SMB (Server Message Block) ** is a protocol for sharing files and printers between Windows computers.
Use ** NetBIOS ** as the underlying protocol. There is also a protocol called ** CIFS ** that extends SMB. CIFS uses TCP / IP directly.
--Installing Samba
$ sudo apt-get install samba samba-common-bin
--Create a shared folder
$ sudo mkdir /var/samba
--Creating a user to access a shared folder
$ sudo useradd smbuser
$ sudo passwd smbuser
--Permission change
$ sudo chown smbuser:smbuser /var/samba/
--Samba access settings
$ sudo pdbedit -a smbuser
--Public settings for shared folders
$ sudo cp -p /etc/samba/smb.conf /etc/samba/smb.conf.org
$ sudo vi /etc/samba/smb.conf
Add the following to the /etc/samba/smb.conf
file.
[share]
comment = Share Folder
browseable = yes
path = /var/samba
writable = yes
valid users = smbuser
force user = smbuser
--Restarting Samba
$ sudo /etc/init.d/samba restart
pdbedit The pdbedit command manages the SAM database (the database for Samba users). It is used to manage the user accounts held in the SAM database and can only be run by root.
You can use pdbedit to add user accounts, delete user accounts, change user accounts, list user accounts, and import user accounts.
--List database user accounts
$ sudo pdbedit -L
smbuser:1001:
--List database user accounts (details)
$ sudo pdbedit -L -v
---------------
Unix username: smbuser
NT username:
Account Flags: [U ]
User SID: S-1-5-21-1950213270-485466186-3954191822-1000
Primary Group SID: S-1-5-21-1950213270-485466186-3954191822-513
Full Name:
Home Directory: \\raspberrypi01\smbuser
HomeDir Drive:
Logon Script:
Profile Path: \\raspberrypi01\smbuser\profile
Domain: RASPBERRYPI01
Account desc:
Workstations:
Munged dial:
Logon time: 0
Logoff time: never
Kickoff time: never
Password last set:water,25 March 2020 15:11:40 JST
Password can change:water,25 March 2020 15:11:40 JST
Password must change: never
Last bad password : 0
Bad password count : 0
Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
If the firewall is enabled on the Raspberry Pi side, it is assumed that the communication used by Samba is permitted, and the access methods for Windows and Mac are described.
Windows To access Samba on Windows 10, you need an SMB client. For Windows 10, SMB 1.0 is disabled, so follow the steps below to enable the SMB client.
\\ <Raspberry Pi IP address>: \ share \
on the network from Explorer.Mac For Mac, access from Finder.
smb: // <Raspberry Pi IP address>
in [Server Address] and click [Connect].Make effective use of Raspberry Pi and use it for remote work.
Recommended Posts