yum install initscripts -y

yum install openssh
yum install openssh-server
yum -y install openssh-clients

安装openssh-server
 找到了 /etc/ssh/ 目录下的sshd服务配置文件 sshd_config,用vi编辑器打开

将文件中,关于监听端口、监听地址前的 # 号去除


# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
Port 22
#AddressFamily any
ListenAddress 0.0.0.0
ListenAddress :: 
然后开启允许远程登录

# Authentication:

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10 
最后,开启使用用户名密码来作为连接验证

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes

 
保存文件,退出
3、 开启 sshd 服务,输入   service sshd restart