Last active
August 21, 2016 09:14
-
-
Save 1000k/2bf3148ec13915225c4db88f895319b6 to your computer and use it in GitHub Desktop.
VPSサーバーを構築後、基本的な設定を行うシェル。実行ユーザーの追加、 root ログインの禁止、 ssh 公開鍵設定など。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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