Aamazon Web Service EC2 Ubuntu New user and SSH connection host

Source: Internet
Author: User

This article photo Http://docs.aws.amazon.com/zh_cn/AWSEC2/latest/UserGuide/managing-users.htmlhttp://docs.aws.amazon.com/zh_ Cn/awsec2/latest/userguide/ec2-key-pairs.html#retrieving-the-public-key1. Obtaining a public key by key pair (KeyPair) Run $ssh-keygen-y on the local Terminla when prompted to enter the file where the key is located. Please specify the path to your. Pem file, such as/path_to_key_pair/my-key-pair.pem the command will return a public key: such as Ssh-rsa aaaab3nzac1yc2eaaaadaqabaaabaqclksfknkusevgj3eyhce53pcjqp3maahdfcvbs7o6vhz2itxcih+pndsuaw+wnqn/mzphtk/a/ gu8jezoowbkm4yxyb/wb96xbifvesfjuop/d6rjhjoi0ibxrlslnbitntckij7fbtxjmxlvvwjryduilbmtjytwb+qhyxumozce5pjz5/ i8sejtjnv3iaog/cqk+0fzzqaejaahco+cy/5wrubkrhmfjr6hcxkvjdwpkyqs3xqc0+fmuzofz221cbt5imucxxpkx4rwi+ Z7wb3rbbqoqzd8v7yeb7ozlpnwoyn0qfu0xa246ra8qfyicnywi3f05p6klxexample2. Then SSH remote server with the initial account. If the EC2 instance system is Ubuntu, the local terminal runs: $ssh-i YOURPRIVATEKEY.PEM [email protected] New User$adduser NewUser switch to NewUser and then configure the public key $sudo Su-newuser$mkdir. Ssh$chmod. Ssh$touch Authorized_keys Open Editor Editor. Ssh/authorized_keys add the public key obtained in step 1 to the file to save the exit. 3. Test whether you can sign in to AWS at the last exit of Step 2 (two times) with the new account until you exit AWS and return to local. 

Run: $ssh-i YOURPRIVATEKEY.PEM [email protected] assume success. The above configuration takes effect. 4. (Optional) Disable password login # vi/etc/ssh/sshd_configpasswordauthentication no# service ssh restart. SSH stop/waiting. SSH start/running, Process 7262


Aamazon Web Service EC2 Ubuntu New user and SSH connection host

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.