
作者:余小小
Xshell
Xshell [1] 是一个强大的安全终端模拟软件,它支持SSH1, SSH2, 以及Microsoft Windows 平台的TELNET 协议。Xshell 通过互联网到远程主机的安全连接以及它创新性的设计和特色帮助用户在复杂的网络环境中享受他们的工作。
Xshell可以在Windows界面下用来访问远端不同系统下的服务器,从而比较好的达到远程控制终端的目的。除此之外,其还有丰富的外观配色方案以及样式选择。
Xshell下载
官网下载是可以免费试用
百 度 网 盘 :https:/ /pan.baidu.com/s/1_7zLJQVN0Vkv-FwDjcqCMw
提取码:yxqz
检查SSH服务状态
shell
systemctl status sshd

如果没有出现一大堆,则需要安装ssh
shell
yum install openssh-server
如果ssh服务没有启动则打开SSH服务
shell
service sshd start

检查tcp类型端口是否启动
shell
netstat -lptn |grep -i 22
防火墙状态
shell
systemctl status firewalld

检查防火墙是否放行22端口
shell
firewall-cmd --permanent --query-port=22/tcp

no:没有放行
允许外部访问22端口
shell
firewall-cmd --zone=public --add-port=22/tcp --permanent

重启防火墙服务
systemctl restart firewalld.service

再次检查放行22端口状态

xshell新建会话
左上角点击文件---新建

配置会话属性
名称:自定义
主机:centos的静态ip

修改字体颜色
alt+p或者找到顶部的设置logo进入属性设置

修改配色方案

自定义配色方案

安装宝塔面板
shell
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

所有的提示选中y即可
允许外部访问22端口8888端口
firewall-cmd --permanent --query-port=8888/tcp
查看宝塔默认信息
如果忘记了bt的用户名密码和登录网址则可以使用下面的语句
shell
bt defalut
远程命令
实例代码
shell
ssh [-l longin_name] [-p port] [user@]hostname
ssh root@192.168.100.120
ssh免密登录
-
进入用户的home目录
shellcd /root/.ssh/ root用户就在root目录下的.ssh目录 cd /home/omd/.ssh/ 普通用户在家目录下的.ssh目录
-
根据dsa算法生成私和公钥【默认在当前用户的home目录】
shellssh-keygen -t dsa 一路回车即可 id_dsa 私钥(钥匙) id_dsa.pub 公钥(锁)
-
拷贝公钥给目标服务器
shellssh-copy-id -i id_dsa.pub root@192.168.100.120
-
查看目标服务器生成的文件
shellll /home/omd/ .ssh/authorized_keys
-
免密码登录目标服务器
shellssh rooot@192.168.100.120
scp
-
从本地复制到远程
shellscp a.txt root@192.168.100.12:/.data
-
从远程复制到本地
shellscp root@192.168.100.120:/a.txt ./
sftp
安全协议,使用22端口
1.登录
shell
sftp root@192.168.100.120
2.从远程服务器获取文件
shell
sftp> get -r /data/* 递归获取
Fetching /data/a.txt to a.txt
3.上传文件到远程服务器
shell
sftp> put b.txt /data
Uploading b.txt to /data/b.txt
实例:
使用cmd给linux的根目录下的upload目录(提前新建好文件夹)发送data.txt文件(window内置了sftp)

在linux里查看是否上传成功了

使用FlashFXP工具
链接:https://pan.baidu.com/s/1FbkzAICg00bLyqSMEaUs5Q
提取码:e9lk

按需求选择

上传文件
找到你的本地要上传的文件,直接拖到服务器区域

解决shell连接Linux太慢的问题
原因:因为在登录时,需要反向解析dns。
解决方法:修改linux配置文件,vi /etc/ssh/sshd_config。
vi /etc/ssh/sshd_config
将 # UseDNS yes 此处注释去掉
改为:UseDNS no
然后重启sshd服务
systemctl restart sshd