博客
关于我
亚马逊AWS实例设置为账号密码登陆
阅读量:464 次
发布时间:2019-03-06

本文共 739 字,大约阅读时间需要 2 分钟。

亚马逊AWS实例的登录方式

作为一个技术工作者,我个人对AWS实例的默认密钥登录方式感到不太习惯,毕竟需要记住一大串长得很不方便的密钥。于是,我尝试将其改为常规的账号密码登录方式,记录下整个过程。

1. 连接到实例

如果你使用的是XShell或者类似的终端工具,登录的时候记得选择centos用户,而不是root用户。虽然root用户权限很高,但实际操作中不太方便。连接时可能会遇到如下的提示:

WARNING! The remote SSH server rejected X11 forwarding request.Please login as the user "centos" rather than the user "root".

2. 设置密码登录

在改为密码登录之前,需要先为root用户设置密码。操作步骤如下:

  • 输入命令设置root用户密码:
  • sudo passwd root
    1. 切换到root用户:
    2. su root
      1. 输入以下命令启用用户名密码登录:
      2. sed -ri 's/^#?(PasswordAuthentication)s+(yes|no)/1 yes/' /etc/ssh/sshd_config
        sed -ri 's/^#?(PermitRootLogin)s+(yes|no)/1 yes/' /etc/ssh/sshd_config
        sed -ri 's/^/#/;s/sleep 10"s+/&n/' /root/.ssh/authorized_keys
        1. 重启SSH服务使其生效:
        2. service sshd restart

          这样设置之后,你就可以通过root账号使用密码登录到实例了。如果需要管理员权限,可以继续使用su root命令登录。

    转载地址:http://ozkbz.baihongyu.com/

    你可能感兴趣的文章
    nnU-Net 终极指南
    查看>>
    No 'Access-Control-Allow-Origin' header is present on the requested resource.
    查看>>
    NO 157 去掉禅道访问地址中的zentao
    查看>>
    no available service ‘default‘ found, please make sure registry config corre seata
    查看>>
    no connection could be made because the target machine actively refused it.问题解决
    查看>>
    No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
    查看>>
    No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
    查看>>
    No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
    查看>>
    No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
    查看>>
    No mapping found for HTTP request with URI [/logout.do] in DispatcherServlet with name 'springmvc'
    查看>>
    No module named 'crispy_forms'等使用pycharm开发
    查看>>
    No module named cv2
    查看>>
    No module named tensorboard.main在安装tensorboardX的时候遇到的问题
    查看>>
    No module named ‘MySQLdb‘错误解决No module named ‘MySQLdb‘错误解决
    查看>>
    No new migrations found. Your system is up-to-date.
    查看>>
    No qualifying bean of type XXX found for dependency XXX.
    查看>>
    No resource identifier found for attribute 'srcCompat' in package的解决办法
    查看>>
    no session found for current thread
    查看>>
    No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
    查看>>
    NO.23 ZenTaoPHP目录结构
    查看>>