2020.04.06
Hard: RaspberryPI3 modelB
| $ sha256sum
2020-02-13-raspbian-buster-lite.zip |
| $ unzip
2020-02-13-raspbian-buster-lite.zip |
| $ sudo dd
bs=4096 if=2020-02-13-raspbian-buster.img
of=/dev/sdb |
| $ sudo raspi-config |
| $ sudo adduser hogehoge |
| hogehoge ALL=(ALL)
NOPASSWD: ALL |
| # deluser pi |
| # usermod
-G netdev hogehoge |
| $ ip addr show |
| interface wlan0 static ip_address=192.168.3.30/24 static routers=192.168.3.1 static domain_name_servers=192.168.3.1 |
| $ sudo apt-get
install ibus-mozc |
raspberryPiをサーバー、パソコンをクライアントとしてパソコン側からRaspberryPiへsshでアクセスする設定
(1) rasperryPiはraspi-configでsshサーバーをenableにしておく
(2) パソコン側で公開鍵ペアを作成する
鍵を作るときのパスワードはサーバーのパスワードとは別物である。
| $
ssh-keygen -t rsa -b 4096 Generating public/private rsa key pair. Enter file in which to save the key (/home/hogehoge/.ssh/id_rsa): このままenter Enter passphrase (empty for no passphrase): パスワードを入れる Enter same passphrase again: 再度パスワードを入れる Your identification has been saved in /home/hogehoge/.ssh/id_rsa. Your public key has been saved in /home/hogehoge/.ssh/id_rsa.pub. The key fingerprint is: SHA256:DXkvga6+uGv9L1dUdRiNEJcLezFVedhNVMhKsB+vEgU hogehoge@akagera The key's randomart image is: +---[RSA 4096]----+ | E.s+o#&| | o co.@.*| | + +.o= +.| | . + =+oo | | a S +.o.. | | . d o.. | | .. .q. | | .o. . .. | | .+ooo.+. | +----[SHA256]-----+ |
| $
ssh-copy-id -i .ssh/id_rsa.pub
hogehoge@raspberrypi.local /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub" The authenticity of host 'raspberrypi.local (192.168.3.30)' can't be established. ECDSA key fingerprint is SHA256:6LtS3P30HdhynlZJZiPUvD11DTRS+X/oMKt4ADmr4vI. Are you sure you want to continue connecting (yes/no)? yes /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys hogehoge@raspberrypi.local's password: こ こは鍵のパスワードではなくサーバーログインのパスワード Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'hogehoge@raspberrypi.local'" and check to make sure that only the key(s) you wanted were added. |
| $ ssh
hogehoge@raspberryp.local Enter passphrase for key '/home/hogehoge/.ssh/id_rsa':秘密鍵のパスワードを入れる |
| $sudo apt-get
install ufw |
| $ sudo ufw default deny |
| $ sudo ufw allow 22 |
| $ sudo ufw enable |
| $ sudo ufw reload |
| $ sudo ufw status |
| $ sudo ufw delete allow 80 |
| $ sudo ufw disable |