One, two Linux servers and client A: Host Server B: Client server
on the host serverAon UseSSHcommand to generate a key pair, the command is as follows:ssh-keygen-t RSAand then you can return
Find id_rsa.pub under current user directory:/home/root/.ssh/
SCP local file (id_rsa.pub) remote user name @ remote host (B) IP address: Where to save the remote host
now to the remote hostBSee if there is a corresponding file, of course, here also to note. SSHwhether the directory exists
Append the public key that you just transmitted to the . Ssh/authorized_keys File
The command is as follows:
cat Id_rsa.put >> Ssh/authorized_keys
chmod. SSH
chmod. Ssh/authorized_keys
when configuring the settings for note permissions
Two,rsync command to achieve data synchronization error
If you still need to enter a password when using rsync Sync, check the System log discovery:
Jan 09:49:05 localhost sshd[44946]: User Tomcat not allowed because account is locked
Jan 09:49:05 localhost sshd[44946]: input_userauth_request:invalid user tomcat [PreAuth]
Jan 09:49:11 localhost sshd[44946]: Connection closed by 192.168.2.250 [PreAuth]
From the log view, just beginning to think that the Tomcat user was locked out:
=============== Linux User Unlocked =====================
View User: Pam_tally2--user account
Unlock User: Pam_tally2-r-u account
Through the pam_tally2--user command found no lock, finally by looking for data is sshd does not open PAM
PAM is not enabled for the SSH service, it is commented or set to "no" explicitly:
~# grep usepam/etc/ssh/sshd_config#usepam Yes
Open Sshd_config usepam yes;service sshd Restart new problems, ordinary users can not login
Cd/etc/pam.d;ls-l sshd to see if this file exists, no need to create
#%pam-1.0auth required pam_ sepermit.soauth include password-authaccount required pam_nologin.soaccount include password-authpassword include password-auth# pam_selinux.so close should be the first session rulesession required pam_ selinux.so closesession required pam_loginuid.so# pam_selinux.so open should only be followed by sessions to be executed in the user contextsession required pam_selinux.so open Env_paramssession optional pam_keyinit.so force revokesession include password-auth
Re-open Usepam Yes;service sshd Restart successfully solve the problem!
Linux Trusted host (SSH)