Linux ssh服务器配置代码实例
(编辑:jimmy 日期: 2024/11/19 浏览:3 次 )
使用如下终端命令可以在 Linux 主机中安装 ssh服务器sudo apt-get install openssh-server
lin@lin-machine:~$ sudo apt-get install openssh-server Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libck-connector0 ncurses-term openssh-client openssh-sftp-server ssh-import-id Suggested packages: libpam-ssh keychain monkeysphere rssh molly-guard The following NEW packages will be installed: libck-connector0 ncurses-term openssh-server openssh-sftp-server ssh-import-id The following packages will be upgraded: openssh-client 1 upgraded, 5 newly installed, 0 to remove and 438 not upgraded. Need to get 1,180 kB of archives. After this operation, 3,429 kB of additional disk space will be used. Do you want to continue"htmlcode">lin@lin-machine:~$ ifconfig eth0 Link encap:Ethernet HWaddr 00:0c:29:f1:a1:37 inet addr:192.168.147.136 Bcast:192.168.147.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fef1:a137/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3950 errors:0 dropped:0 overruns:0 frame:0 TX packets:514 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1453734 (1.4 MB) TX bytes:63371 (63.3 KB) 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:180 errors:0 dropped:0 overruns:0 frame:0 TX packets:180 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:13377 (13.3 KB) TX bytes:13377 (13.3 KB)在PC上查看ip地址
Microsoft Windows [版本 6.1.7601] 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。 E:\Users\libra>ipconfig Windows IP 配置 ... 以太网适配器 VMware Network Adapter VMnet8: 连接特定的 DNS 后缀 . . . . . . . : 本地链接 IPv6 地址. . . . . . . . : fe80::9074:b9f5:ddaf:9082%25 IPv4 地址 . . . . . . . . . . . . : 192.168.147.1 子网掩码 . . . . . . . . . . . . : 255.255.255.0 默认网关. . . . . . . . . . . . . : ... E:\Users\libra>【备注】pc和linux虚拟机在同个网段的
测试他们是否可以ping
lin@lin-machine:~$ ping 192.168.147.1 PING 192.168.147.1 (192.168.147.1) 56(84) bytes of data. 64 bytes from 192.168.147.1: icmp_seq=1 ttl=64 time=0.586 ms 64 bytes from 192.168.147.1: icmp_seq=2 ttl=64 time=0.442 ms 64 bytes from 192.168.147.1: icmp_seq=3 ttl=64 time=0.435 ms ^C --- 192.168.147.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 1999ms rtt min/avg/max/mdev = 0.435/0.487/0.586/0.074 ms【可能存在一些异常的原因】注意: Windows 7 默认打开了系统防火墙,是禁ping的,如果在Linux下ping Windows
7,需要先关闭Windows 7 的防火墙。没有问题后我们在SecureCRT上开始测试
【备注】根据自己的情况来写IP和主机名
来测试一下
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
下一篇:Linux deb包解压、修改等操作方法代码示例