OSの初期設定
前回でOSのインストールが終わりました。
OSのインストールが終わったら、初期設定を行います。
ここではログインするユーザを作成するまでを目指します。
OSアップデート
前回の設定でインストールを行った場合、すでに画面にRaspberry Pi 3のデスクトップが表示されているかと思います
画面左上に表示されているターミナルを起動し、以下の文を入力、エンターを押してください。
sudo apt-get update && sudo apt-get install
途中、本当に実行するか否かの問い合わせが表示されるのでY→Enterを押してください。
ユーザの作成
Raspberry Piにログインできるユーザーとパスワードはデフォルトで以下のように設定されています。
デフォルトで、ということは世界中どのラズベリーパイでもこのIDとパスワードでログインできてしまうんですね。
ユーザーID | パスワード |
---|---|
root | なし |
pi | raspberry |
このままでも問題はありませんが、もし外部に接続してサーバなどで使用する場合、第三者が簡単にアクセスできてしまうので、対策を施します。
-
rootのパスワードを変更します。画面上のターミナルを起動して次の通り入力してください。
pi@raspberrypi:~ $ sudo passwd root Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully pi@raspberrypi:~ $
新しいパスワードを入力するよう促されるので、入力してエンターを押すと設定できます。入力しているパスワードは表示されません。
-
新しいユーザーを作成します。ここでは仮にretaxを作成してみます。
pi@raspberrypi:~ $ sudo adduser retax Adding user `retax' ... Adding new group `retax' (1001) ... Adding new user `retax' (1001) with group `retax' ... Creating home directory `/home/retax' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for retax Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] Y pi@raspberrypi:~ $
-
retaxをpiと同じグループに設定します。
# piの所属するグループを確認する pi@raspberrypi:~ $ id pi uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),101(input),108(netdev),999(spi),998(i2c),997(gpio) # retaxを同じグループに追加する pi@raspberrypi:~ $ sudo usermod -aG adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,spi,i2c,gpio retax # 確認 pi@raspberrypi:~ $ id retax uid=1001(retax) gid=1001(retax) groups=1001(retax),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),101(input),108(netdev),999(spi),998(i2c),997(gpio) pi@raspberrypi:~ $
-
piのパスワードを変更しておきます。
$ passwd Changing password for hoge (current) UNIX password: New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully
ユーザ名を入力するとパスワードを聞かれますので、2回連続で入力します。上述の通り、パスワードは表示されませんのでご注意ください。
その後、Full NameやRoom Numberなどを尋ねられますが、全てEnterキーを教えて省略可能です(入力してもOK)
以上です。
次はこの新しいユーザーを使ってログインするところまで設定します。
コメント