** ユーザの追加の前に [#eb4d6bd7]
- Linuxなのでユーザの追加方法は adduserでできるのですが、ちょっとしたコツと注意点が~
あって焦るといけないのでメモしておきます。
- LANDISKでは、ルート(/)がroになっているので''/etc''周りを触るには、rwにしておかないと~
ファイルに書き込めないよ!と怒られるので注意が必要です。ちなみにmountコマンドでデフォルト値を~
みてみると下記のようになってるです。
bash$ mount
rootfs on / type rootfs (rw)
/dev/root on / type ext2 (ro)
/proc on /proc type proc (rw)
none on /dev/pts type devpts (rw)
/dev/ram0 on /mnt/ram0 type ext2 (rw)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
/dev/hda3 on /mnt/hda3 type ext2 (rw)
- ちなみにルート(/)がroでないとCOLOR(RED){立ち上がってこない}らしいので、凄く注意が必要です。
** ユーザの追加 [#v267146a]
- これは、Linuxとかを触る人のお約束事ですが、必ずターミナルを2つ以上立ち上げておいて下さい。~
なんでかと言うと万が一、ターミナルが1コお亡くなりになっても接続されいる状態のターミナルが~
あるからって事ですが、LANDISKについてはこれを日常化しといた方がいいかもしれません。
- ''hogehoge''ユーザを作る場合
-- 手順としては、ルート(/)をrwに設定してからユーザを作成し、ルート(/)をroに戻すだけ。
bash$ sudo su
Password:
# mount -o rw,remount /
# adduser hogehoge
Changing password for hogehoge
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
Enter new password:
Re-enter new password:
Password changed.
# mount -o ro,remount /
-- ターミナルを新規に開いて''hogehoge''でログインできるか確認します。
- このままでは、ホームディレクトリがCOLOR(RED){/home/hogehoge}となってしまい、ルート(/)がro権限のため~
作業がやりずらいので''/mnt/hda3''にホームディレクトリを作成するように変更します。
# mount -o rw,remount /
# vi /etc/passwd
hogehoge:x:501:501:Embedix User,,,:/mnt/hda3/hogehoge:/bin/bash ←こんな風にね
# mkdir /mnt/hda3/hogehoge
# chown -R hogehoge:hogehoge /mnt/hda3/hogehoge
# mount -o ro,remount /
** root権限の付与 [#e332836c]
- ''hogehoge''ユーザにもroot権限を付与しちゃいましょう。※作業は慎重に行ってね。
-- viにてCOLOR(RED){/etc/sudoers}ファイルを編集します。read-onlyなので強制書き込み''q!''で書き込むこと。
# mount -o rw,remount /
# ls -al /etc/sudoers
-r--r----- 1 root root 635 Apr 2 02:11 /etc/sudoers
# vi /etc/sudoers
hogehoge ALL=(ALL) ALL
:q!
# mount -o ro,remount /
-- ターミナルを新規に開いて''hogehoge''でログインしsudoコマンドでrootになれるか確認します。
bash$ sudo su
Password:
#
: COLOR(RED){注意} | ここでも作業が終わったら''mount -o ro,remount /''を行うこと。あと''mount''コマンドで確認すること。