Skip to content

Instantly share code, notes, and snippets.

@1000k
Last active August 21, 2016 09:14
Show Gist options
  • Save 1000k/2bf3148ec13915225c4db88f895319b6 to your computer and use it in GitHub Desktop.
Save 1000k/2bf3148ec13915225c4db88f895319b6 to your computer and use it in GitHub Desktop.
VPSサーバーを構築後、基本的な設定を行うシェル。実行ユーザーの追加、 root ログインの禁止、 ssh 公開鍵設定など。
# ADD USER
useradd foobar
passwd foobar
# Enter password.
# APPEND USER TO WHEEL GROUP (to grant sudo privilege)
usermod -G wheel foobar
visudo
# Edit following line:
# %wheel ALL=(ALL) ALL
# Add public key in `/root/.ssh/authorized_keys` before the following commands.
cp /root/.ssh/authorized_keys /home/foobar/.ssh/
chown -R foobar:foobar /home/foobar/
vim /etc/ssh/sshd_config
# Edit as:
# PermitRootLogin no
# PasswordAuthentication no
systemctl restart sshd.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment