centos 下启用sshd服务
ssh localhost
错误信息为:ssh: connect to host localhost port 22: Connection refused
这种错误很主要的一个原因是sshd服务没有启动,先启动sshd服务后就没有问题了
1、查卡服务是否启用
ps -ef | grep ssh
2、如果没有启用 则要安装
yum install openssh-server
3、安装完之后开启
/etc/init.d/sshd start
如果/etc/init.d/sshd start出现:
Generating SSH1 RSA host key: [FAILED]
解决办法:
$ yum search openssh
$ sudo yum install openssh
如果已经安装openssh,启动sshd
$ sudo /etc/init.d/sshd start
sshd re-exec requires execution with an absolute path
[honki@localhost ~]$ sudo service sshd start
Generating SSH1 RSA host key: [ OK ]
Generating SSH2 RSA host key: [ OK ]
Generating SSH2 DSA host key: [ OK ]
Starting sshd: [ OK ]
4、如果还是连不上 关闭防火墙
/etc/init.d/iptables stop
如此即可。
ssh localhost 免登录:
[bigdata@localhost ~]$ mkdir .ssh
[bigdata@localhost ~]$ chmod 700 .ssh
[bigdata@localhost ~]$ cd .ssh/
[bigdata@localhost .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
一路回车
Enter file in which to save the key (/home/bigdata/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/bigdata/.ssh/id_rsa.
Your public key has been saved in /home/bigdata/.ssh/id_rsa.pub.
The key fingerprint is:
51:c6:8b:54:45:09:cf:47:c0:89:0a:80:44:73:2e:df bigdata@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
| o+.o. o=*++. |
| .+ . .ooo+. |
| . . o.o .o . |
| o . o.. . |
| . E S |
| |
| |
| |
| |
+-----------------+
[bigdata@localhost .ssh]$ ls -l
total 8
-rw-------. 1 bigdata bigdata 1675 Jan 24 15:54 id_rsa
-rw-r--r--. 1 bigdata bigdata 411 Jan 24 15:54 id_rsa.pub
[bigdata@localhost .ssh]$ cp id_rsa.pub authorized_keys
[bigdata@localhost .ssh]$ chmod 644 authorized_keys
[bigdata@localhost ~]$ ssh localhost
Last login: Thu Jan 24 15:55:14 2013 from localhost.localdomain
$vi /etc/ssh/sshd_config
RSAAuthentication yes # 启用 RSA 认证
PubkeyAuthentication yes # 启用公钥私钥配对认证方式
AuthorizedKeysFile .ssh/authorized_keys # 公钥文件路径(和上面生成的文件同)
service sshd restart
分享到:
相关推荐
centos7 docker image, 支持 sshd ,root 密码123456,支持systemd
在CentOS7下,设置ssh自启动,修改ssh监听端口
Centos8 搭建DNS服务器
主要介绍了centos 7 修改sshd | 禁止 root登录及sshd端口脚本定义,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
CentOS下的Git服务器的创建!
centos 下安装svn服务器
CentOS下搭建NFS服务器总结,文件服务器搭建过程记录。
CentOS 7.0启用iptables防火墙.docx
CentOS6.5 openssh8.6p1离线升级包及升级步骤
centos 7.9服务器 离线 搭建svn服务器 ,该文章适用于 开发人员 实施人员 项目经理用于项目文档管理 代码管理,而不指定如何在centos7.9环境下离线搭建svn服务器,因为大多数的网站只是介绍yum install 的方式,但是...
Centos下安装redis服务v1.0
前言 Hugepages是从Linux kernal 2.6后被引入的,其目的是更好的管理超大内存。在oracle数据库服务器上所使用hugepages主要的优势有以下几点: 1. 避免SGA被交换到swap; 2. 减轻TLB的压力; 3. 减少页表的开销;...
CentOS5.4 下配置Apache服务器详细步骤
centos之SSH安装centos之SSH安装centos之SSH安装centos之SSH安装
在centos7中安装配置Samba服务器,主要介绍Samba服务涉及的配置文件以及安装过程,以及防火墙、senlinux的设置
最近项目要求数据传必须使用sftp,但sftp又不能直接使用22端口,不安全,网上查询的ssh和sftp分离相关的资料都是基于centos7的,于是经过研究尝试,完成了基于centos6版本的服务分离
CentOS下安装NTP时间服务器
在CentOS下安装Ngix服务及集群PHP、Tomcat
记录了本人在CentOS服务器下安装mysql服务,Nginx服务和PHP的详细过程。
ssh服务离线安装包,ubuntu 离线安装,一定要按顺序启动 sudo dpkg -i openssh-client_6.6p1-2ubuntu1_amd64.deb sudo dpkg -i openssh-sftp-server_6.6p1-2ubuntu1_amd64.deb sudo dpkg -i libck-connector0_0.4.5-...