Password-free login between Linux regular users

Source: Internet
Author: User

Objective:
    1. Between the same machine to achieve the common user-free login: NN01 user1-Free login User2
    2. Between the different machines to achieve the common user-free login: NN01 user1-free landing NN01 user1
I. To achieve a free login between the same machine and the ordinary user

Free login between ordinary users and use root for the password-free login, the basic settings are the same, except for ordinary users need to modify. SSH and Authorized_keys permissions are not valid.
On the premise of landing user1,

ssh-keygen  #使用 ssh-keygen 命令,一直按回车,就可以生成当前机器的公钥 id_rsa.pub ,cp .~/ssh/id_rsa.pub  /home/user2/.ssh/id_rsa.pub.user1 # user2 家目录下如果没有 .ssh ,可以使用mkdir 创建
    • Login User2
cat ~/.ssh/id_rsa.pub.user1 >> ~/.ssh/authorized_keys  #如果authorized_keys 不存在使用touch 创建chmod 700 ~/.sshchmod 600 ~/.ssh/authorized_keys

Re-login to the user user2, the first time you need to enter a password the second time you do not need to enter a password to directly login

Two. Non-secret login between different machines for ordinary users

The basic settings are similar, except that there is a need to use SCP to copy between different machines
Under the premise of NN01 landing user1

ssh-keygen  #使用 ssh-keygen 命令,一直按回车,就可以生成当前机器的公钥 id_rsa.pub ,scp .~/ssh/id_rsa.pub  /home/user2/.ssh/id_rsa.pub.nn01 # 后缀主要为了区分这个公钥是哪台机器
    • Landing in NN02 user1
cat ~/.ssh/id_rsa.pub.nn01 >> ~/.ssh/authorized_keys  chmod 700 ~/.sshchmod 600 ~/.ssh/authorized_keys
    • Re ssh [email protected] -use Telnet NN02 on NN01, the first time you need to enter a password the second time you do not need to enter a password to directly login

Unlock commands,:

Far away from the Ark of the dust the respect is won, not others alms. Linux system user Lock and Unlock

1. Use passwd command to lock and unlock account

[[email protected] ~]# passwd-l LXJ    ----l lock locking password for user Lxj.passwd:success[[email protected] ~]# Pass Wd-s LXJ    ---View status lxj LK 2016-06-20 0 99999 7-1 (Password locked.) [[Email protected] ~]# [[email protected] ~]# passwd-u lxj    ---Unlock unlocking password for user Lxj.passwd:success[[ema Il protected] ~]# passwd-s lxjlxj PS 2016-06-20 0 99999 7-1 (Password set, SHA512 crypt.)

2. Use Usermod command to lock and unlock account

Password-free login between Linux regular users

Related Article

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.