【Raspberry Pi】Configure Raspberry Pi to realize file transfer

Install the operating system

The choice is the official Raspbian
provided after entering:
write picture description here
write picture description here
RASPBIAN STRETCH WITH DESKTOP is a graphical interface, RASPBIAN STRETCH LITE is a command line interface, generally download RASPBIAN STRETCH LITE.
After downloading, unzip the file to get an .img file,
write picture description here
and then use Win32DiskImager to write the file to the SD card. Remember to clear the SD card before writing.
write picture description here
After the writing is successful, you can insert the SD card into the Raspberry Pi to install the system. Since I directly connected the display, I did not use the SSH method. If there is no display, please refer to the following information to install the system using SSH. After starting the Raspberry Pi, enter the account password, the default account password: the account is pi, and the password is raspberry. You can view the version of the system and the number of system bits in the Raspberry Pi



lsb_release -a  //查看系统版本
Uname -a //查看系统位数

Mount Samba share files

Enter the following commands in sequence:

sudo apt-get install samba 
sudo apt-get install samba samba-common-bin

After the installation is successful, modify the configuration file and add the following content at the bottom of the file. Here, set /home/pi/Public as the shared folder:
sudo nano /etc/samba/smb.con

[Public]
   comment = Public Storage  # 共享文件夹说明
   path = /home/pi/Public # 共享文件夹目录
   read only = no # 不只读
   create mask = 0777 # 创建文件的权限
   directory mask = 0777 # 创建文件夹的权限
   guest ok = yes # guest访问,无需密码
   browseable = yes # 可见

When finished, enter ctrl+x, Y to exit the configuration file.
Restart the Samba service:
sudo /etc/init.d/samba restart

Since we just set /home/pi/Public as a shared folder in the configuration file, we need to manually create a Public file and modify its permissions, and enter the commands in turn to create the Public file:

cd /home/pi
mkdir Public

Modify its permissions:
sudo chmod -R 777 /home/pi/Public/
After completion, you will be able to see an additional RASPBERRYPI on the network on your computer. Clicking on it is the directory where the /home/pi/Public folder on the Raspberry Pi is located, and you can directly pull the file into it. Check the existence of this file on the Raspberry Pi. You can also use the browser to enter: , to view the files in the Raspberry Pi. (You can use the command: ifconfig to view the IP of the Raspberry Pi)


\\树莓派的IP地址\Public

Set Samba to auto-start at boot

To set startup, you need to create a file in /etc/init.d/.

sudo nano /etc/init.d/sambaserver

The contents of the sambaserver file are as follows:

### BEGIN INIT INFO
# Provides:          sambaserver
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
### END INIT INFO

case "$1" in
  start)
    su pi -c '/etc/init.d/samba start :1'
    echo "Starting Samba "
    ;;
  stop)
    su pi -c '/etc/init.d/samba -kill :1'
    echo "Samba stopped"
    ;;
  *)
    echo "Usage: /etc/init.d/samba {start|stop}"
    exit 1
    ;;
esac
exit 0

Reference: Raspberry Pi
Getting Started Tutorial
Raspberry Pi File Sharing (samba)
Using Samba for LAN Sharinghttp:
//shumeipai.nxez.com/2013/09/04/login-rpi-with-vnc.html ?variant=zh- cn

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325875984&siteId=291194637