サーバーにユーザーを追加する、セットアップ関係
Categories:
server
ユーザーを作成する
useradd testuser
ユーザーにパスワード作成する
passwd testuser
SSH公開鍵を設定してtestuserでssh鍵認証loginできるようにする
rsyncコマンドを使うと楽勝です。 ほい rsync --archive --chown=testuser:testuser ~/.ssh /home/testuser
大切なこと=やることは /home/testuser を作成して rootの.ssh/authorized_keys
をコピーするということです。
つくったuserにsudo権限をあたえる。
sudo なんちゃらCommand
を実行できるようにするためのものです。 usermod -aG sudo testuser
ついでにrootによるsshログイン禁止にしちゃおう
/etc/ssh/sshd_config ここの PermitRootLogin no//これをnoにする そしてrestartで反映する sudo service ssh restart
完了!
参考
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04