Ssh configuration host trust authentication
Sshd's configuration file / etc/ssh/sshd_config port modifies the IP protocol supported by sshd's port AddressFamily any, any indicates ipv4 and ipv6 ListenAddress 0.0.0.0 specifies the listening address, 0. 0J 0 indicates any address, and can also specify a specific address KeyRegenerationInterval 1h key regeneration interval ServerKeyBits 1024 server-side key length LoginGraceTime 2m login tolerance period (password waiting time) whether PermitRootLogin yes allows root to log in directly to MaxAuthTries 6 number of password attempts RSAAuthentication yes uses key-based authentication PubkeyAuthentication yes uses key-based authentication AuthorizedKeysFile .ssh / authorized_keys key storage path PasswordAuthentication yes based on password authentication UsePAM yes uses pam authentication # Banner none displays the file content specified by banner (print Welcome message) # whether PrintMotd yes displays the contents of / etc/motd file # whether PrintLastLog yes displays the information of the last login, generally not
Whitelist and blacklist: blacklist appears at the same time, blacklist is invalid / etc/hosts.allow / etc/hosts.deny
Ssh ssh ip COMMAND executes the command and returns ssh root@192.168.56.28 ifconfig-l to specify the login user name to invoke the remote graphical command-X-Y
Key-based authentication: (mutual trust authentication) ssh-keygen-t [rsa | dsa] specify encryption algorithm-f / path specify output path-N 'password' specify password 1 to generate a pair of keys (public key and private key) 2 send the public key bed to a user's home directory in the server. ssh/authorized_keys file (whose public key, who can log in to the current host)
[root@LinuxTest ~] # ssh-keygen-t rsa creates public key and private key Generating public/private rsa key pair. Enter file in which to save the key (/ root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in / root/.ssh/id_rsa. Your public key has been saved in / root/.ssh/id_rsa.pub. The key fingerprint is: 6b:e9:a2:39:af:0c:0d:e8:95:6f:ff:4a:fb:fc:17:34 root@LinuxTest The key's randomart image is: +-- [RSA 2048]-+ |. . E | |. .o S. . | |. .o. O. |. .o. +. | | oo.+oo. | | =. = +. | +-+
[root@LinuxTest ~] # scp .ssh / id_rsa.pub root@192.168.56.89:/root/.ssh/authorized_keys send the public key to the remote server root@192.168.56.89's password: id_rsa.pub 100396 0.4KB/s 00:00 [root@LinuxTest ~] # ssh 192.168.56.89 Last login: Tue Dec 20 09:29:41 2016 from 192.168.56.28 [root@ray ~] #
Ftp [root@LinuxTest ~] # sftp of sftp ssh protocol type 192.168.56.89 Connecting to 192.168.56.89.