问题描述:

实现Linux秘钥和密码同时认证

解决方案:

vim /etc/ssh/sshd_config

基本参数:

PermitRootLogin yes         #允许root认证登录
PasswordAuthentication yes  #允许密码认证

RSAAuthentication yes       #秘钥认证
PubkeyAuthentication yes    
详细参数列表
[root@zabbix ~]# cat /etc/ssh/sshd_config
#       $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.#Port 22   #ssh默认端口
#AddressFamily any
#ListenAddress 0.0.0.0   #绑定监听IP
#ListenAddress ::# Disable legacy (protocol version 1) support in the server for new
# installations. In future the default will change to require explicit
# activation of protocol 1
Protocol 2# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO# Authentication:#LoginGraceTime 2m
#PermitRootLogin yes  #允许root认证登录
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10#RSAAuthentication yes   #秘钥认证
#PubkeyAuthentication yes
#AuthorizedKeysFile     .ssh/authorized_keys  #默认公钥存放的位置
#AuthorizedKeysCommand none
#AuthorizedKeysCommandRunAs nobody# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes  #允许密码认证# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
#KerberosUseKuserok yes# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM no
UsePAM yes# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none# no default banner path
#Banner none# override default of no subsystems
Subsystem       sftp    /usr/libexec/openssh/sftp-server# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       ForceCommand cvs server

相关文章:

Putty SSH秘钥登录使用:         http://www.cnblogs.com/xiaochina/p/5793940.html

ssh_config与sshd_config却别:http://www.cnblogs.com/xiaochina/p/5802008.html

ssh对登陆限制:                       http://www.cnblogs.com/xiaochina/p/5920057.html

转载于:https://www.cnblogs.com/xiaochina/p/6867298.html

Linux ssh服务开启秘钥和密码认证相关推荐

  1. 秘钥加密码的登录模式

    应用场景:有时候我们要给远在北京或者国外的开发人员服务器的权限,为了保证服务器的安全性我们不想让他们知道服务器的root登陆密码,所以我们可以给他们用秘钥加密码的登陆模式. 原理:公钥加密 私钥解密. ...

  2. linux ssh服务状态,查看linux ssh服务信息及运行状态方法

    关于ssh服务端配置有不少文章,例如 linux下ssh服务配置,这里仅列举出一些查看ssh服务相关信息的常用命令. 1 安装 apt-get install openssh-server 2 完成后 ...

  3. linux ubuntu 开启ssh服务,开启SSH服务远程登录ubuntu

    Ubuntu系统(14.04 LTS) ssh–secure shell,提供安全的远程登录.从事嵌入式开发搭建linux开发环境中,ssh的服务的安装是其中必不可少的一步.ssh方便一个开发小组中人 ...

  4. linux ssh服务的优化,SSH服务端配置、优化加速、安全防护

    CentOS7自带的SSH服务是OpenSSH中的一个独立守护进程SSHD.由于使用telnet在网络中是明文传输所以用其管理服务器是非常不安全的不安全,SSH协议族可以用来对服务器的管理以及在计算机 ...

  5. Linux | ssh服务原理、配置及操作

    目录 ssh服务 ssh服务的配置文件 配置文件常用配置详解: 加密方法 登陆验证原理 实现公钥认证,免密码登录的步骤 公钥认证排错 ssh登录方法 客户端配置 ssh服务 ssh是什么? ssh - ...

  6. git ssh配置完后拉取代码_Git中SSH key配置秘钥生成和如何拉取代码

    Git是分布式的代码管理工具,首先找公司的gitlab管理员帮你开通gitlab账号,发现本地Git仓库和gitlab仓库仍然不能传输项目,原因是远程的代码管理是基于SSH的,要通过SSH加密才能传输 ...

  7. linux ssh服务端下载文件,Linux SSH服务端配置文件设置

    一 SSH概述 SSH 由 IETF 的网络小组(Network Working Group)所制定:SSH 为建立在应用层基础上的安全协议.SSH 是目前较可靠,专为远程登录会话和其他网络服务提供安 ...

  8. ssh linux 配置文件详解,Linux ssh服务常用配置的详细描述及建议配置

    SSH服务常用选项描述 配置文件: /etc/ssh/sshd_config 1.AddressFamliy any:支持那IP协议:比如ipv4,ipv6,:默认 any: 2.Port 22 :S ...

  9. linux ssh服务,Linux配置SSH服务以便实现远程连接

    Linux用户们一定想要知道该怎么开启SSH服务吧,SSH服务是Linux系统远程连接的重要方式,所以如何配置SHH服务也让很多用户感到纠结.现在小编就帮大家解决这个问题. 配置方法: 查询\安装SS ...

  10. Ubuntu ssh 服务开启方法

    网上有很多介绍在Ubuntu下开启SSH服务的文章,但大多数介绍的方法测试后都不太理想,均不能实现远程登录到Ubuntu上,最后分析原因是都没有真正开启ssh-server服务.最终成功的方法如下: ...

最新文章

  1. p2p webrtc服务器搭建系列1: 房间,信令,coturn打洞服务器
  2. WINCE cvrtbin命令简介
  3. [hihoCoder]无间道之并查集
  4. 剑指Offer - 面试题7. 重建二叉树(递归)
  5. 郎朗和机器人合奏_从世界机器人大会看新中国70年科技发展成就
  6. 苹果召回部分产品;罗永浩锤子商城并入字节跳动;美团打车上线上海南京 | 极客头条...
  7. cookie怎样存储数据?
  8. 配置无线AP 采用POE供电模块怎么配置无线AP没有POE交换机
  9. 泰拉瑞亚服务器config修改,泰拉瑞亚配置修改方法详解 泰拉瑞亚怎么修改游戏配置 Config文件-游侠网...
  10. Tracing event
  11. 大唐之路(4)一号店入驻要求
  12. 对随机数去重并进行排序 java
  13. Java开发-空指针(NullPointException)
  14. c++ opencv 身份证OCR识别:前期数据训练库准备(tesseractOCR)
  15. 【Redis扩展篇(一)】过期策略
  16. 非常实用的JavaScript代码
  17. python-字体颜色
  18. DRIVER_POWER_STATE_FAILURE蓝屏分析
  19. kibana安装教程
  20. 定时执行专家 5.0(一款制作精良、功能全面、使用简单的专业定时执行工具软件)

热门文章

  1. python float转化为int_python – 将矩阵的某些列从float转换为int
  2. 用VB.net实现对.ini文件的读写操作的类
  3. springboot + redis(单机版)
  4. centos ifconfig 无法使用问题
  5. Mongoose使用——nodejs结合mongodb
  6. 【互联网安全】阿里云安全专家为你详细解读内容安全及防护
  7. 敏捷开发一千零一问:怎样处理重要但不明白的任务?
  8. IHttpHandler给图片加水印
  9. 【11月29】PF 粒子滤波的多维运动模型代码
  10. 3月7日 当前动力电池竞争格局