## 新建普通用戶 $ adduser ubuntu $ apt-get install sudo ## 將用戶加入sudo組 $ usermod -a -G sudo ubuntu
$ su ubuntu $ mkdir -p ~/.ssh $ cd ~/.ssh ## 添加公鑰 $ touch authorized_keys $ cat '你的公鑰字符串' >> authorized_keys $ chmod 600 authorized_keys $ chmod 700 ~/.ssh
$ vim /etc/ssh/sshd_config RSAAuthentication yes PubkeyAuthentication yes ## 禁用root帳號登陸 PermitRootLogin no ## 禁用密碼登陸 PasswordAuthentication no $ service sshd restart