Linux ssh服务开启秘钥和密码认证
问题描述:
实现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 // :: djm Exp $ # This is the sshd server system-wide configuration file. See
# sshd_config() 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 ) support in the server for new
# installations. In future the default will change to require explicit
# activation of protocol
Protocol # HostKey for protocol version
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key # Lifetime and size of ephemeral version server key
#KeyRegenerationInterval 1h
#ServerKeyBits # Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO # Authentication: #LoginGraceTime 2m
#PermitRootLogin yes #允许root认证登录
#StrictModes yes
#MaxAuthTries
#MaxSessions #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
#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
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval
#ClientAliveCountMax
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups ::
#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
Linux ssh服务开启秘钥和密码认证的更多相关文章
- windows 上 OpenSSH 服务 启用秘钥登录(微软真心逆天)
windows 上 OpenSSH 服务 启用秘钥登录(微软真心逆天) windows 安装 OpenSSH 服务 最近需要在windows 服务器上部署自动发布程序,那么就需要用到 scp 和 ss ...
- Linux之间配置免秘钥访问
环境说明 [root@localhost1 ~]# cat /etc/redhat-release CentOS release 6.5 (Final) [root@localhost1 ~]# un ...
- git乌龟http/https以及ssh clone的秘钥配置永久免密码登录设置
1.安装 安装Git 安装TortoiseGit 乌龟客户端 首先下载安装一个git客户端这个就不多说了基本就是next一直到底 安装后首次新建一个项目project在git服务器上 2.配置 1.注 ...
- linux服务搭建----ssh服务开启
//ssh 服务 ssh 192.168.88.254 如何开启 service sshd restart 关掉该服务 servicesshd stop ...
- linux系统的ssh服务开启方法
操作方法: 1.编辑sshd_config文件 root@linux:~# vi /etc/ssh/sshd_config 2.检查如下配置项: PasswordAuthentication ye ...
- linux之kali系统ssh服务开启
1.修改sshd_config文件,命令为:vi /etc/ssh/sshd_config 2.将#PasswordAuthentication no的注释去掉,并且将NO修改为YES //我的ka ...
- linux——ssh服务
SSH服务(TCP端口号22):安全的命令解释器 为客户机提供安全的Shell 环境,用于远程管理 SSH基于公钥加密(非对称加密)技术: 数据加密传输: 客户端和服务器的身份验证: 公钥 和 私钥 ...
- Hadoop中ssh+IP、ssh+别名免秘钥登录配置
1.为什么要进行 SSH 无密码验证配置? Hadoop运行过程中需要管理远端Hadoop守护进程,在Hadoop启动以后,NameNode是通过SSH(Secure Shell)来启动和停止各个Da ...
- SSH公/私秘钥的生成及使用
如果使用GitHub比较多的朋友,对SSH Key肯定也不陌生,当我们SSH进行代码的pull&push时,往往需要我们配置SSH Key. 如果Linux用的多朋友,肯定对SSH Key都很 ...
随机推荐
- 安装arcgis10.5不能启动服务的解决方案转
柚子的二分口粮地 来自:http://www.cnblogs.com/youzi-xuchongyou/p/7218422.html 安装arcgis10.5不能启动服务的解决方案 最近由于公司需要, ...
- extjs 动态设定 DateField 最大值 最小值
yxrqDate.minValue = new Date();yxrqDate.maxValue = new Date(9000,1,1);yxrqDate.validate(); //var pic ...
- Lambda与委托
Lambda 表达式是一个可用于创建委托或表达式树类型的匿名函数. 通过使用 lambda 表达式,可以可作为参数 或 返回为函数调用值的本地函数.Lambda 表达式对于编写 LINQ 查询表达式特 ...
- BZOJ 4145 [AMPPZ2014] The Prices 解题报告
感觉也是一个小清新题.. 我们考虑设立状态 $Dp[i][s]$ 表示考虑了前 $i$ 个商店后,购买状态为 $s$ 的最小花费. 转移的话就枚举每个商店 $i$,首先令: $$Dp[i][s] = ...
- cgroup子系统2_devices子系统
devices子系统用于控制cgroup中全部进程能够訪问哪些设备,三个控制文件:devices.allow,devices.deny,devices.list. devices.allow用于指定c ...
- Cocos2d-x3.3RC0通过JNI调用Android的Java层URI代码发送短信
1.Jni不在赘述.翻看前面博客 2.直接上代码 1)Java层,直接加在AppActivity.java中 public class AppActivity extends Cocos2dxActi ...
- 混沌数学之ASin模型
相关软件:混沌数学之离散点集图形DEMO 相关代码: class ASinEquation : public DiscreteEquation { public: ASinEquation() { m ...
- Simplify Path leetcode java
题目: Given an absolute path for a file (Unix-style), simplify it. For example, path = "/home/&qu ...
- 【软引用】弱引用 图片的加载与缓存 OOM
在java.lang.ref包中提供了几个类:SoftReference类.WeakReference类和PhantomReference类,它们分别代表软引用.弱引用和虚引用. ReferenceQ ...
- IOS程式语法之block的使用掌握
在现阶IOBlock 是iOS在4.0之后新增的程式语法,严格来说block的概念并不算是基础程式设计的范围,对初学者来说也不是很容易了解,但是在iOS SDK 4.0之后,block几乎出现在所有新 ...