## 新建普通用户 $ 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