べつに乗り換えたわけじゃないけど、ラズパイ4がまともに動くのがraspbianしかないので
しかたないのでこれで運用中。
なんと、ssh サーバは動いていないのがデフォルトなの?
中の設定を見ようとしてsshでつなごうとしたらつながらない。
そこで
$ sudo systemctl status ssh
ってやってみたらなんとサーバはお休み中。
しかたないので
$ sudo systemctl enable ssh
$ sudo systemctl start ssh
で起動。
pi@raspberrypi:~ $ sudo systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-12-05 18:51:29 JST; 4min 29s ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 2483 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 2484 (sshd)
Tasks: 1 (limit: 4915)
Memory: 2.0M
CGroup: /system.slice/ssh.service
mq2484 /usr/sbin/sshd -D
12月 05 18:51:29 raspberrypi systemd[1]: Starting OpenBSD Secure Shell server...
12月 05 18:51:29 raspberrypi sshd[2484]: Server listening on 0.0.0.0 port 22.
12月 05 18:51:29 raspberrypi sshd[2484]: Server listening on :: port 22.
12月 05 18:51:29 raspberrypi systemd[1]: Started OpenBSD Secure Shell server.
12月 05 18:55:19 raspberrypi sshd[2542]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.1.50 user=pi
12月 05 18:55:21 raspberrypi sshd[2542]: Failed password for pi from 192.168.1.50 port 57083 ssh2
12月 05 18:55:27 raspberrypi sshd[2542]: Accepted password for pi from 192.168.1.50 port 57083 ssh2
12月 05 18:55:27 raspberrypi sshd[2542]: pam_unix(sshd:session): session opened for user pi by (uid=0)
んでもって、ファイル共有サービスをここで提供しようと思いまして、
32GBの小さなUSBフラッシュメモリを使いまして、ここに共有ファイルをためていくということをします。
もうすでにUSBメモリをマウントするところまでやっちゃったので、そこまでの過程が欲しい人は
どこかで探してください。
では共有方法ですが、やはりsambaが一番楽かとおもいますので、sambaを入れます。
samba でアミーゴ
$ sudo apt-get install samba
でオーケーです。
あとは設定。
今回はUSBメモリをすべて使いますのでそれをマウントしておいて、
$ sudo chmod 755 /data
$ sudo chown -R pi:pi /data
として置いて、あとは設定ファイルを書き換えます。
うちの環境では以下のようにしました。
/etc/samba/smb.conf
interfaces = 127.0.0.0/8 eth0 192.168.1.0/24
bind interfaces only = yes
[share]
comment = secret
path=/data
guest ok = no
writable = yes
valid users = pi
browsable = no
create mode =0775
directory mode = 0775
今回は共有していますが、少し条件を厳しくしています。
で、あとはユーザ追加、
$ sudo smbpasswd -U pi -a
でパスワードを入力すれば桶。
最後にプロセスを再起動させます。
$ sudo systemctl restart smbd nmbd
これで、Windowsからファイル共有できます。
でも、USBメモリが2.0使っているので激遅です。