How to Setup and Secure Linux SSH Logins to use Private PEM Keys

from:http://www.curvve.com/blog/guides/2013/how-to-create-multiple-amazon-ec2-keypair-logins-for-contractors-and-employees/

 

SSH logins are susceptible to brute force attacks. A thousand things can go wrong which could give someone unauthorized access to your server. The best way to secure your SSH login is to use Public/Private PEM keys. This is default login type for Amazon EC2 servers. Unfortunately Amazon’s interface only created a single account. This tutorial will show you how to setup additional PEM keys for other users.

Once you’ve logged into your server, do the following:

Step 1: New Account setup

Here we will create the new account, and add them to the sudoers group.

sudo su
passwd NewUser
visudo

Optional: Add the user to Sudoers

Step 2: Generate the Public/Private key files

Now we will create the public and private key files for NewUser. This tutorial assumes that the user is part of the ec2-users group. If not, please make sure to change the code where applicable.

Step 3: Download your private key

You will now have to download, or copy the contents of your private pem file. This should be called NewUser.pem. 
If you are going to copy the contents of the file to a key file on your local system, just copy and paste the data into a new file.

Before using your key, make sure to change the permissions to 600.

Step 4: Test your SSH Login

Now let’s test our password-less login to make sure the private pem files are working.

That should do it! Hope you find this tutorial helpful. Feel free to ask any questions!

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值