Linux Trusted host (SSH)

Source: Internet
Author: User
Tags rsync

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

    1. 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)

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.