1.查看ssh状态:
ps -e | grep ssh
出现:
1027 ? 00:00:00 sshd
说明已启动,若只有agent,说明没有启动,可自行手动启动
2.启动或关闭ssh服务
sudo /etc/init.d/ssh start
sudo /etc/init.d/ssh stop
3.查看对方电脑ip
ifconfig
例如:
enp4s0 Link encap:Ethernet HWaddr 30:9c:23:15:4b:61
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:19
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:10590 errors:0 dropped:0 overruns:0 frame:0
TX packets:10590 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1022579 (1.0 MB) TX bytes:1022579 (1.0 MB)
wlp2s0 Link encap:Ethernet HWaddr 9c:b6:d0:68:82:07
inet addr:*********** Bcast:10.180.255.255 Mask:255.255.0.0
inet6 addr: fe80::20dc:fa33:d615:22f5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1524014 errors:0 dropped:2 overruns:0 frame:0
TX packets:61941 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:363467481 (363.4 MB) TX bytes:17557004 (17.5 MB)
wlp2so后面的**部分即为网址
4.连接对方电脑
ssh wanglin@对方ip
若询问秘钥问题,回答yes
5.退出ssh
exit