Linux学习笔记四----------远程连接和SSH

下载centos minimal版本的iso,创建另一个虚拟机,其余操作和桌面版类似

将虚拟机网络连接方式改成桥接网卡模式

查看服务器ip信息,ifconfig(yum install net-tools)、ip addr

连接远程终端,用SSH进行连接

将电脑配置成SSH服务器,安装openssl软件

如果只想用SSH远程连接到别的机器,sudo yum isntall openssh-clients

如果想让自己的机器开放SSH服务,sudo yum install openssh-server

安装完成后,会自动开启sshd进程,也可以手动开启,sudo systemctl start sshd;sudo systemctl stop sshd;sudo systemctl status sshd;restart;enable

因此,服务器安装SSH服务器,yum install openssh-server;systemctl start sshd

客户端安装SSH工具,windows,putty,xshell,securecrt;Linux,yum install openssh-clients;macos,默认已经安装

centos客服端连接centos服务器,ssh root@ip

config文件可以配置ssh,方便批量管理多个ssh连接

全局config,

ssh客户端配置,/etc/ssh/ssh_config

ssh服务端配置,/etc/ssh/sshd_config

查看config配置手册,man sshd_config

局部配置文件(ssh localhost,客户端)

~/.ssh/config(手动创建,并将权限修改为600)

Host

    HostName

    Port

    User

SSH免密码登录,公钥验证登录

在客户机中生成密钥对 ssh-keygen,将公钥传输到服务器 ssh-copy-id root@ip

原文地址:https://www.cnblogs.com/xxp17457741/p/12490788.html