阿里云 VPS 开启之路之一

本文最后更新于 2017年8月29日 晚上

阿里云是的香港服务器对于的国内用户来说是一个很好的低延迟的中转。以下是一些第一次启动可能需要做的事情。

  1. 卸载阿里云安骑士

    下载 wget http://update.aegis.aliyun.com/download/uninstall.sh

    执行下列命令:

    1
    2
    chmod +x uninstall.sh
    ./uninstall.sh
  2. 卸载阿里云aliyun.service

    killall aliyun-service && echo "" >/usr/sbin/aliyun-service

  3. 删除阿里云登录界面欢迎信息

    1
    2
    vi /etc/motd
    #编辑/删除倒数第二行的 Welcome to Alibaba Cloud Elastic Compute Service !
  4. 添加用户,授予 sudo权限

    1. 添加用户

      adduser username

    2. 给该用户添加密码

      1
      2
      3
      passwd username
      New password:
      Retype new password:
    3. 授予 sudo 权限

      vi /etc/sudoers 然后找到,如下添加

      1
      2
      3
      ## Allow root to run any commands anywhere
      root ALL(ALL) = ALL
      username ALL(ALL) = ALL # username 是新建的用户名

      在保存的时候可能需要wq!

  5. 修改 SSH 默认端口

    1
    2
    3
    4
    5
    6
    vi /etc/ssh/sshd_config
    Port 2000
    MaxAuthTries 6
    PermitEmptyPasswords no
    service ssh restart #CentOS6
    systemctl restart sshd #CentOS7
  6. 禁止 root 用户登录

    1
    2
    3
    4
    vi /etc/ssh/sshd_config
    PermitRootLogin no
    service ssh restart #CentOS6
    systemctl restart sshd #CentOS7

现在就可以用新建的那个用户登录了。


阿里云 VPS 开启之路之一
https://yuluod.github.io/2017/08/24/阿里云-VPS-开启之路之一/
作者
yuluo
发布于
2017年8月24日
许可协议