1、SSH服务
功能:远程管理linux服务器
	  默认端口22,C/S架构
	  服务端开启ssh服务,安装(openssh-server)
	  客户端需要专门工具如SRC...
1)控制服务状态
  systemctl list-unit-files | grep sshd.service		查看是否开机自启动
  systemctl status sshd.service				查看服务状态
  systemctl stop sshd.service				停止服务
  systemctl start sshd.service				启动服务
  systemctl restart sshd.service				重启服务
  systemctl disable/enable sshd.service			是否开机自启动
2)修改默认端口
	  netstat -nltp|grep :22			查看端口使用情况
修改端口号——》修改ssh配置文件
	  rpm -ql openssh-server			查看ssh服务的相关文件
	  vim /etc/ssh/sshd_config		修改配置文件中的Port
	  systemctl restart sshd.service		重启服务
重启不成功的情况下,要注意setenforce 0,再次重启
2、搭建服务总结
  1)关闭防火墙和selinux(实验环境下)
  2)配置软件仓库
  3)安装程序对应的软件包
	    * 安装相应软件
	    * 确认软件是否成功安装 yum list installed | grep xxx
	    * 查看软件的文件列表rpm -ql(配置文件、程序本身、man手册)
  4)了解配置文件
	    man 5 xxxconf
  5)根据需求通过修改配置文件完成服务搭建
  6)启动服务/开机自启动
  7)测试验证
3、基于SSH服务的命令
  1)客户端安装软件 openssh-clients
	    * 客户端远程连接登录服务器;
	      ssh [Options] 远程IPAddress	
		      -p 	指定端口号
		      -l	指定用户名
		      如:ssh -p 10022 -l pingchuan 192.168.159.100
	    * 客户端远程访问服务器并执行相应命令(未登录):
		      ssh 【选项】 ip command
  2)Linux下远程拷贝命令scp
	    * 将本地文件拷贝到远程服务器
	      scp [Options] local_file  remote_ip:/path
	    * 将远端服务器上的文件拷贝到本地
	      scp [Options]  remote_ip:/file local_path
		      -P 指定ssh服务的端口号
		      -r 拷贝目录
	      ll -d /backup		查看/backup目录的权限信息
	      查看当前拷贝文件的用户是否对本地存放文件的路径有写权限
原文:https://www.cnblogs.com/pingchuan/p/13087022.html