博客
关于我
亚马逊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/

    你可能感兴趣的文章
    npm和yarn的使用对比
    查看>>
    npm如何清空缓存并重新打包?
    查看>>
    npm学习(十一)之package-lock.json
    查看>>
    npm安装 出现 npm ERR! code ETIMEDOUT npm ERR! syscall connect npm ERR! errno ETIMEDOUT npm ERR! 解决方法
    查看>>
    npm安装crypto-js 如何安装crypto-js, python爬虫安装加解密插件 找不到模块crypto-js python报错解决丢失crypto-js模块
    查看>>
    npm安装教程
    查看>>
    npm报错Cannot find module ‘webpack‘ Require stack
    查看>>
    npm报错Failed at the node-sass@4.14.1 postinstall script
    查看>>
    npm报错fatal: Could not read from remote repository
    查看>>
    npm报错File to import not found or unreadable: @/assets/styles/global.scss.
    查看>>
    npm报错TypeError: this.getOptions is not a function
    查看>>
    npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
    查看>>
    npm淘宝镜像过期npm ERR! request to https://registry.npm.taobao.org/vuex failed, reason: certificate has ex
    查看>>
    npm版本过高问题
    查看>>
    npm的“--force“和“--legacy-peer-deps“参数
    查看>>
    npm的安装和更新---npm工作笔记002
    查看>>
    npm的常用操作---npm工作笔记003
    查看>>
    npm的常用配置项---npm工作笔记004
    查看>>
    npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
    查看>>
    npm编译报错You may need an additional loader to handle the result of these loaders
    查看>>