[LINUX] Raspberry Pi Bad Knowledge

Introduction

I think many people have started to touch Linux from Raspberry Pi (hereinafter RPi). I don't know if that's the reason, but I often see Japanese articles related to RPi recommending bad settings. (I think that the person who first wrote the article with the bad settings has inherited much bad knowledge ...) So I will write a proper setting.

This time I'm writing for Raspbian.

About the minimum necessary items for development

It is well written if you write on the assumption that you have a personal computer that can be used for development

--HDMI cable

Does not have to be the worst. Since RPi can be installed headlessly, you can set it all without monitors. Furthermore, if you want to use GUI, you can connect with VNC etc. However, it is not so if it is said that it is completely unnecessary, and if remote connection (OTG connection) becomes impossible, it is a nice level to have it because you can directly connect monitors and isolate the cause.

About security

Well written

Set a root password!

This is a lie. Do not set. This is not set on purpose. If it is not set, it cannot be used, but if it is set, it can be used. It is vulnerable in terms of security.

About ssh activation

Well written

mkdir /boot/ssh

This is subtle. The manual states:

When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled and the file is deleted. The content of the file does not matter google translate: ** When Pi starts, it looks for ssh files. If found, SSH is enabled and the file is deleted. ** **

It is clearly described as ** file **. Also, ** files will be deleted **, so the directory will not be deleted. Garbage remains. As will be described later, this has various inconveniences and security problems.

Also, this is also a common description, and this is a bad manual, but [^ 1]

Make it a file called ssh with absolutely no extension! (Don't get .txt!)

It is also subtle. You don't have to be so careful. This is because the unit file that enables ssh is as follows, and it is also enabled in ssh.txt.

sshswitch.service


[Unit]
Description=Turn on SSH if /boot/ssh is present
ConditionPathExistsGlob=/boot/ssh{,.txt}
After=regenerate_ssh_host_keys.service

[Service]
Type=oneshot
ExecStart=/bin/sh -c "systemctl enable --now ssh && rm -f /boot/ssh ; rm -f /boot/ssh.txt"

[Install]
WantedBy=multi-user.target

This is done at boot time, so in the case of the ** directory created and SSH enabled ** method described above, if you reboot later when you later disable SSH for security reasons, SSH will be done again. Will be effective **, isn't it?

About IP address

This is not a bad thing, but there is an easier way to do it.

In a common description,

Check the IP address (when SSH) ~, set a fixed IP address ~

I think that there is, but if it is a new development environment, you can SSH using Bonjour (mDNS). By the way, connect as follows.

root@0ec7cd4678a7:~# ssh [email protected]

in conclusion

There is an image that many people write appropriate content for the number of accesses for content that is popular with beginners. Let's have a fun Linux life after carefully determining what is right!

Recommended Posts

Raspberry Pi Bad Knowledge
Raspberry Pi backup
What is Raspberry Pi?
GPGPU with Raspberry Pi
Raspberry Pi video camera
Let's do Raspberry Pi?
DigitalSignage with Raspberry Pi
Raspberry Pi 4 setup memo
Cython on Raspberry Pi
Raspberry Pi system monitoring
Introduced python3-OpenCV3 to Raspberry Pi
Indoor monitoring using Raspberry Pi
Mutter plants with Raspberry Pi
Install Raspberry Pi OS (Raspbian)
I talked to Raspberry Pi
Introducing PyMySQL to raspberry pi3
Raspberry Pi + Python + OpenGL memo
Raspbian initial settings (Raspberry Pi 4)
raspberry pi 1 model b, python
Introduced pyenv on Raspberry Pi
Use NeoPixel on Raspberry Pi
Install OpenCV4 on Raspberry Pi 3
Install TensorFlow 1.15.0 on Raspberry Pi
Port FreeRTOS to Raspberry Pi 4B
[Raspberry Pi] Stepping motor control with Raspberry Pi
Use vl53l0x with Raspberry Pi (python)
raspberry pi 1 model b, node-red part 17
MQTT on Raspberry Pi and Mac
raspberry pi 4 centos7 install on docker
Serial communication with Raspberry Pi + PySerial
Output from Raspberry Pi to Line
OS setup with Raspberry Pi Imager
Raspberry pi initial setting (for myself)
Try using ArUco on Raspberry Pi
Try L Chika with raspberry pi
OpenCV installation procedure on Raspberry Pi
VPN server construction with Raspberry Pi
Try moving 3 servos with Raspberry Pi
Power on / off Raspberry pi on Arduino
Detect switch status on Raspberry Pi 3
Install OpenMedia Vault 5 on Raspberry Pi 4
03. Pi
Using a webcam with Raspberry Pi
L Chika on Raspberry Pi C #
[Raspberry Pi] Changed Python default to Python3
Build wxPython on Ubuntu 20.04 on raspberry pi 4
Put ROS melodic in Raspberry Pi 4 / Buster
Measure SIM signal strength with Raspberry Pi
Connect two USB cameras to Raspberry Pi 4
Pet monitoring with Rekognition and Raspberry pi
"Honwaka Notification Lamp" on Raspberry Pi Part 2
[Raspberry Pi] Add a thermometer and a hygrometer
Detect "brightness" using python on Raspberry Pi 3!
USB boot on Raspberry Pi 4 Model B
Raspberry Pi Security Infrared Camera (Python Edition)
Hello World with Raspberry Pi + Minecraft Pi Edition
"Honwaka Notification Lamp" on Raspberry Pi Part 1
Build a Tensorflow environment with Raspberry Pi [2020]
Enable UART + serial communication on Raspberry Pi
Adafruit Python BluefruitLE works on Raspberry Pi.
Get BITCOIN LTP information with Raspberry PI