SHH 配置文件
/etc/shhd_config 服务端配置文件
/etc/ssh_config 客户端配置文件
[root@localhost ssh]# chkconfig --list sshd sshd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭 [root@localhost ssh]#
【实验一:修改ssh端口】
1.查找修改的端口是否已经被占用
[root@localhost ssh]# netstat -ln |grep :22 tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN tcp 0 0 :::22 :::* LISTEN [root@localhost ssh]# netstat -ln |grep :80
2.修改配置文件,PORT 改为其他
[root@localhost ssh]# vim /etc/ssh/sshd_config
3.查看修改后的效果
[root@localhost ssh]# netstat -ln |grep :27101 [root@localhost ssh]# service sshd restart 停止 sshd: [确定] 启动 sshd: [确定] [root@localhost ssh]# netstat -ln |grep :27101 tcp 0 0 0.0.0.0:27101 0.0.0.0:* LISTEN tcp 0 0 :::27101 :::* LISTEN
4.linux远程登录
[root@localhost /]# ssh -p27101 192.168.1.2
5.linux远程拷贝 scp
拷贝文件
[root@localhost dump]# scp data1.dump 172.17.4.33:/scp/ Address 172.17.4.33 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT! root@172.17.4.33's password: data1.dump 100% 6560KB 6.4MB/s 00:00 [root@localhost dump]#
拷贝目录
[root@localhost /]# scp -r /dump/ 172.17.4.33:/scp/ Address 172.17.4.33 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT! root@172.17.4.33's password: data1.dump