linux开启ssh服务(Linux ssh服务器配置代码实例)
类别:服务器 浏览量:2918
时间:2022-03-31 19:33:26 linux开启ssh服务
Linux ssh服务器配置代码实例使用如下终端命令可以在 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? [Y/n] Y Get:1 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libck-connector0 amd64 0.4.5-3.1ubuntu2 [10.5 kB] Get:2 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main openssh-client amd64 1:6.6p1-2ubuntu2.11 [564 kB] Get:3 http://cn.archive.ubuntu.com/ubuntu/ trusty/main ncurses-term all 5.9+20140118-1ubuntu1 [243 kB] Get:4 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main openssh-sftp-server amd64 1:6.6p1-2ubuntu2.11 [34.1 kB] Get:5 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main openssh-server amd64 1:6.6p1-2ubuntu2.11 [318 kB] Get:6 http://cn.archive.ubuntu.com/ubuntu/ trusty/main ssh-import-id all 3.21-0ubuntu1 [9,624 B] Fetched 1,180 kB in 22s (51.6 kB/s) Preconfiguring packages ... Selecting previously unselected package libck-connector0:amd64. (Reading database ... 168838 files and directories currently installed.) Preparing to unpack .../libck-connector0_0.4.5-3.1ubuntu2_amd64.deb ... Unpacking libck-connector0:amd64 (0.4.5-3.1ubuntu2) ... Preparing to unpack .../openssh-client_1%3a6.6p1-2ubuntu2.11_amd64.deb ... Unpacking openssh-client (1:6.6p1-2ubuntu2.11) over (1:6.6p1-2ubuntu2.7) ... Selecting previously unselected package ncurses-term. Preparing to unpack .../ncurses-term_5.9+20140118-1ubuntu1_all.deb ... Unpacking ncurses-term (5.9+20140118-1ubuntu1) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a6.6p1-2ubuntu2.11_amd64.deb ... Unpacking openssh-sftp-server (1:6.6p1-2ubuntu2.11) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a6.6p1-2ubuntu2.11_amd64.deb ... Unpacking openssh-server (1:6.6p1-2ubuntu2.11) ... Selecting previously unselected package ssh-import-id. Preparing to unpack .../ssh-import-id_3.21-0ubuntu1_all.deb ... Unpacking ssh-import-id (3.21-0ubuntu1) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for ureadahead (0.100.0-16) ... ureadahead will be reprofiled on next reboot Processing triggers for ufw (0.34~rc-0ubuntu2) ... Setting up libck-connector0:amd64 (0.4.5-3.1ubuntu2) ... Setting up openssh-client (1:6.6p1-2ubuntu2.11) ... Setting up ncurses-term (5.9+20140118-1ubuntu1) ... Setting up openssh-sftp-server (1:6.6p1-2ubuntu2.11) ... Setting up openssh-server (1:6.6p1-2ubuntu2.11) ... Creating SSH2 RSA key; this may take some time ... Creating SSH2 DSA key; this may take some time ... Creating SSH2 ECDSA key; this may take some time ... Creating SSH2 ED25519 key; this may take some time ... ssh start/running, process 17527 Setting up ssh-import-id (3.21-0ubuntu1) ... Processing triggers for libc-bin (2.19-0ubuntu6.9) ... Processing triggers for ureadahead (0.100.0-16) ... Processing triggers for ufw (0.34~rc-0ubuntu2) ...
查看当前的虚拟机的ip地址
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和主机名
来测试一下
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持开心学习网。
您可能感兴趣
- linuxnfs服务教程(使用Docker的NFS-Ganesha镜像搭建nfs服务器的详细过程)
- 宝塔linux面板搭专业版(宝塔linux面板怎么卸载?)
- linuxdocker启动报错提示参数无效(docker 报错 Exited 1 4 minutes ago的原因分析)
- linux如何安装php7.1.5环境(vmware linux系统安装最新的php7图解)
- centos7 apache配置(CentOSLinux下的apache服务器配置与管理方法分享)
- 阿里云服务器搭建linux学习环境(Mac 下阿里云服务器的配置方法)
- linux服务器安装宝塔(linux宝塔面板安装Zabbix监控服务器资源使用状态)
- linux安装phpstudy(PHPStudy下如何为Apache安装SSL证书的方法步骤)
- ftp服务器怎么搭建linux(Linux下使用vsftp搭建FTP服务器附参数说明)
- linux简单脚本(linux脚本基础详细介绍)
- linux系统用ftp传输文件(Linux与Windows XP之间使用FTP互传文件)
- linuxudp通信程序(linux对于UDP的学习)
- linux wait函数(分析从Linux源码看TIME_WAIT的持续时间)
- linux安装nginx启动页面访问不到(apache,nginx上传目录无执行权限的设置方法)
- linux基本命令pwd(在Linux上使用xargs命令的详细教程)
- linux如何搭建ftp服务器(Linux下搭建ftp服务器)
- 融入小人物的喜怒哀乐,黄渤饰演的角色为什么让人观看时欲罢不能(融入小人物的喜怒哀乐)
- 《极限挑战》深访都市夜归人,夜间打工者体验,黄磊录完憔悴了(极限挑战深访都市夜归人)
- Google 推出了一个游戏生成器,让不会编程的你也能自己设计游戏(推出了一个游戏生成器)
- 二胎家庭老大爱闹情绪,用这招很有效(二胎家庭老大爱闹情绪)
- 一个30岁男人外遇失败的全过程(一个30岁男人外遇失败的全过程)
- 《无敌破坏王2》 不聊彩蛋,聊聊我从动画里看到的现实那些事儿(无敌破坏王2不聊彩蛋)
热门推荐
- nginxssl证书怎么设置(nginx结合openssl实现https的方法)
- $(document).ready和window.onload的区别
- phpstudy怎么升级mysql(phpStudy中升级MySQL版本到5.7.17的方法步骤)
- css选择器知识汇总(在Less中写IE的css hack的方法介绍)
- tcp三次握手建立连接的过程(TCP第三次握手传数据过程图解)
- python怎么操作mysql(详解Python的数据库操作pymysql)
- docker安装java8(docker安装java环境的实现步骤)
- phpstudymysql数据库启动不了(phpstudy mysql启动不了的解决方法)
- 怎么调用dede自定义表单(DEDE实现转跳属性文档在模板上调用出转跳地址)
- HttpWebRequest的使用
排行榜
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9