简体   繁体   English

如何使用密码而不是密钥对ubuntu?

[英]How to use password instead of key pairs ubuntu?

我启动了我的Amazon实例,并且正在使用.ppk密钥连接到ssh,我现在该如何禁用它并仅使用密码使用root用户访问权限?

Please try this way. 请尝试这种方式。

  1. From an SSH client, log in to your EC2 instance. 从SSH客户端登录到EC2实例。

Use one of the following user names: 使用以下用户名之一:

For Amazon Linux, the user name is ec2-user. 对于Amazon Linux,用户名是ec2-user。

For RHEL 5, the user name is either root or ec2-user. 对于RHEL 5,用户名是root或ec2-user。

For Ubuntu, the user name is ubuntu. 对于Ubuntu,用户名是ubuntu。

For SUSE Linux, the user name is either root or ec2-user. 对于SUSE Linux,用户名是root或ec2-user。

If ec2-user or root doesn't work, check with your AMI provider. 如果ec2-user或root无法使用,请与AMI供应商联系。

  1. Set a password for user. 设置用户密码。 The example below uses ec2-user as the user: 以下示例使用ec2-user作为用户:

$ sudo passwd ec2-user $ sudo passwd ec2-user

Changing password for user ec2-user. 修改用户ec2-user的密码。

New password: 新密码:

Retype new password: 重新输入新密码:

For example, a successful response looks like this: 例如,成功的响应如下所示:

passwd: all authentication tokens updated successfully. passwd:成功更新所有身份验证令牌。

  1. Update the PasswordAuthentication parameter in the /etc/ssh/sshd_config file: PasswordAuthentication yes 更新/ etc / ssh / sshd_config文件中的PasswordAuthentication参数:PasswordAuthentication是

  2. Restart the SSH service. 重新启动SSH服务。

For Amazon Linux, RHEL 5, and SUSE Linux, use this command: 对于Amazon Linux,RHEL 5和SUSE Linux,请使用以下命令:

sudo service sshd restart sudo服务sshd重新启动

For Ubuntu, use this command: 对于Ubuntu,请使用以下命令:

sudo service ssh restart sudo服务ssh重新启动

  1. Exit the SSH client, and then log in to test the password authentication. 退出SSH客户端,然后登录以测试密码身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM