Objective:
- Between the same machine to achieve the common user-free login: NN01 user1-Free login User2
- 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 创建
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 # 后缀主要为了区分这个公钥是哪台机器
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