LoginSignup
2
2

More than 5 years have passed since last update.

CentOS初期設定

Posted at

さくらクラウドを始めてみるのでcentosの初期設定

個人用アカウント追加してrootをsshできなくするまで

ユーザーの追加

# useradd testuser
# passwd testuser

sudoersの編集

# visudo
--------------下記の箇所を編集--------------
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
testuser  ALL=(ALL)       ALL

wheelに追加

# usermod -G wheel sokuda

suできる人を制限

#vi /etc/login.defs

----------------末尾にでも追加------------
SU_WHEEL_ONLY yes

# vi /etc/pam.d/su
----------------以下の設定をコメント外して有効化-----
auth required /lib/security/pam_wheel.so use_uid 

ここまでで個人のアカウント設定は完了

rootでsshできなくする

$sudo vi /etc/ssh/sshd_config

---------------以下の場所を変更------------
#PermitRootLogin yes
↓
PermitRootLogin no

$sudo service sshd reload
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2