LoginSignup
0
0

More than 5 years have passed since last update.

メモ さくらvps初期設定 2018 centos7

Last updated at Posted at 2018-01-15

概要

基本的にはサーバの設定はprovisioning toolで行いたいが、初期設定だけは手でやりたいみたいなこともある。
そのためのメモ。

追記 2018/02/01
ansible化しました

ユーザ作成

useradd xxx
usermod -G wheel xxx
visudo # で、”%wheel  ALL=(ALL)       NOPASSWD: ALL” を有効に(パスが必要なければ)

ユーザxxxの.ssh設定

# root
su - xxx

# xxx
ssh-keygen -t rsa  # .ssh を作りたい
vim .ssh/authorized_keys  # 手元のid_rsa.pubの内容を貼り付け
chmod 600 !$

# とりあえずここまででssh疎通確認はできる

sshセキュリティ設定

# sshd_configの設定
sudo vim /etc/ssh/sshd_config  # やることは3つ。Port変更, PermitRootLogin => no, PasswordAuthentication => no
sudo systemctl restart sshd.service

# firewalldの設定
sudo cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/
sudo vim !$/ssh.xml  # 変更したポートに合わせる
sudo systemctl reload firewalld

# ssh 疎通確認

yum update

sudo yum -y update  # OSも最新になるはず
sudo reboot

参考

  • さくらのVPS-サーバの初期設定ガイド

https://help.sakura.ad.jp/hc/ja/articles/206208181--%E3%81%95%E3%81%8F%E3%82%89%E3%81%AEVPS-%E3%82%B5%E3%83%BC%E3%83%90%E3%81%AE%E5%88%9D%E6%9C%9F%E8%A8%AD%E5%AE%9A%E3%82%AC%E3%82%A4%E3%83%89
※Centos6

  • CentOS7のfirewalldでsshのポート番号を変更する方法

0
0
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
0
0