1.登录虚拟机
2.关闭本机所有防火墙和杀毒软件
sudo ufw status 查看防火墙状态
sudo ufw disable 关闭防火墙
sudo ufw enable 打开防火墙
3.安装ssh
sudo apt-get install openssh-server 安装ssh
4.修改sshd_config文件
sudo apt-get install vim
cd /etc/ssh
sudo gedit sshd_config
5.ifconfig查看本机ip
7.网络连接模式为NAT
8.带着IP去打开xshell
新建:填入名称和ip
然后按要求输入用户名,密码就可以了
- xshell直接连接服务器
1. ssh 用户名@ip 2.open 连接名 例: [D:~]$ ssh zhangyafei@182.254.179.186 Connecting to 182.254.179.186:22... Connection established. To escape to local shell, press 'Ctrl+Alt+]'. Last login: Thu Sep 26 10:23:12 2019 [zhangyafei@centos ~]$ [D:~]$ open 飞凡空间 Connecting to 182.254.179.186:22... Connection established. To escape to local shell, press 'Ctrl+Alt+]'. Last failed login: Thu Sep 26 17:24:29 CST 2019 from 182.148.112.237 on ssh:notty There were 114 failed login attempts since the last successful login. Last login: Thu Sep 26 17:20:01 2019 from 111.53.196.4 [root@centos ~]#
9.shell上传文件到服务器
- 安装lrzsz:yum install lrzsz
- 上传文件:rz,打开文件窗口选择文件上传
- 文件下载:sz 文件名,打开文件窗口选择下载目录