实验内容参考

简介: 实验内容参考

实验要求

1.禁止root登录,禁用dns反向查询

2.使用zhangsan/密码,可以从192.168.1.2登录远程服务器192.168.1.1

3.客户端wangwu使用密钥对,用zhangsan登录服务器

4.客户端用户wangwu,以zhangsan的身份向远程服务器上传文件test.txt

5.禁止192.168.1.10远程登录linux主机的sshd服务

6.使用sftp将本机的456文件上传到远程主机

7.在win7安装xshell,并登录远程服务器,并实现文件的上传与下载

实验步骤

实验一:使用密码验证登录,并练习文件操作

1.禁止root登录,禁用dns反向查询

#vim   /etc/ssh/sshd_config

PermitRootLogin  no   //此行默认存在,将yes改成no

UseDNS no            //需要添加

#systemctl  restart sshd

2.使用zhangsan/密码,从192.168.1.2登录远程服务器192.168.1.1

1)先在192.168.1.1上创建用户zhangsan

#useradd   zhangsan

#passwd    zhangsan

2)在192.168.1.2上登录192.168.1.1

[root@localhost ~]# ssh  zhangsan@192.168.1.1

[zhangsan@localhost ~]$

3.利用scp命令,从客户端向远程服务器上传文件test.txt

[zhangsan@localhost ~]$ exit   --退到客户机

[root@localhost ~]# touch test.txt

[root@localhost ~]# scp test.txt zhangsan@192.168.1.1:/home/zhangsan

4. 登录服务器,查看是否上传成功

[root@localhost ~]# ssh  zhangsan@192.168.1.1

[zhangsan@localhost ~]$ll

5.将服务器/tmp/test1.txt文件下载到客户机

#在服务器的/tmp目录下创建一个测试文件

[zhangsan@localhost ~]$touch  /tmp/test1.txt

[zhangsan@localhost ~]$ exit    --退到客户机

[root@localhost ~]# scp  zhangsan@192.168.1.1:/tmp/test1.txt  /tmp   #下载

[root@localhost ~]#ll  /tmp  --查看客户机/tmp下是否下载了文件

6.使用sftp将本机的456文件上传到远程主机

[root@localhost ~]#touch  456

[root@localhost ~]#sftp  zhangsan@192.168.1.1

Sftp>put  456

7.在windows7上安装xshell6

8.在windows客户机上登录linux服务器

实验一:使用密码验证登录,并练习文件操作

1.禁止root登录,禁用dns反向查询

#vim   /etc/ssh/sshd_config

PermitRootLogin  no   //此行默认存在,将yes改成no

UseDNS no            //需要添加

#systemctl  restart sshd

2.使用zhangsan/密码,从192.168.1.2登录远程服务器192.168.1.1

1)先在192.168.1.1上创建用户zhangsan

#useradd   zhangsan

#passwd    zhangsan

2)在192.168.1.2上登录192.168.1.1

[root@localhost ~]# ssh  zhangsan@192.168.1.1

[zhangsan@localhost ~]$

3.利用scp命令,从客户端向远程服务器上传文件test.txt

[zhangsan@localhost ~]$ exit   --退到客户机

[root@localhost ~]# touch test.txt

[root@localhost ~]# scp test.txt zhangsan@192.168.1.1:/home/zhangsan

4. 登录服务器,查看是否上传成功

[root@localhost ~]# ssh  zhangsan@192.168.1.1

[zhangsan@localhost ~]$ll

5.将服务器/tmp/test1.txt文件下载到客户机

#在服务器的/tmp目录下创建一个测试文件

[zhangsan@localhost ~]$touch  /tmp/test1.txt

[zhangsan@localhost ~]$ exit    --退到客户机

[root@localhost ~]# scp  zhangsan@192.168.1.1:/tmp/test1.txt  /tmp   #下载

[root@localhost ~]#ll  /tmp  --查看客户机/tmp下是否下载了文件

6.使用sftp将本机的456文件上传到远程主机

[root@localhost ~]#touch  456

[root@localhost ~]#sftp  zhangsan@192.168.1.1

Sftp>put  456

7.在windows7上安装xshell6

8.在windows客户机上登录linux服务器

实验一:使用密码验证登录,并练习文件操作

1.禁止root登录,禁用dns反向查询

#vim   /etc/ssh/sshd_config

PermitRootLogin  no   //此行默认存在,将yes改成no

UseDNS no            //需要添加

#systemctl  restart sshd

2.使用zhangsan/密码,从192.168.1.2登录远程服务器192.168.1.1

1)先在192.168.1.1上创建用户zhangsan

#useradd   zhangsan

#passwd    zhangsan

2)在192.168.1.2上登录192.168.1.1

[root@localhost ~]# ssh  zhangsan@192.168.1.1

[zhangsan@localhost ~]$

3.利用scp命令,从客户端向远程服务器上传文件test.txt

[zhangsan@localhost ~]$ exit   --退到客户机

[root@localhost ~]# touch test.txt

[root@localhost ~]# scp test.txt zhangsan@192.168.1.1:/home/zhangsan

4. 登录服务器,查看是否上传成功

[root@localhost ~]# ssh  zhangsan@192.168.1.1

[zhangsan@localhost ~]$ll

5.将服务器/tmp/test1.txt文件下载到客户机

#在服务器的/tmp目录下创建一个测试文件

[zhangsan@localhost ~]$touch  /tmp/test1.txt

[zhangsan@localhost ~]$ exit    --退到客户机

[root@localhost ~]# scp  zhangsan@192.168.1.1:/tmp/test1.txt  /tmp   #下载

[root@localhost ~]#ll  /tmp  --查看客户机/tmp下是否下载了文件

6.使用sftp将本机的456文件上传到远程主机

[root@localhost ~]#touch  456

[root@localhost ~]#sftp  zhangsan@192.168.1.1

Sftp>put  456

7.在windows7上安装xshell6

8.在windows客户机上登录linux服务器

9.在windows客户机桌面上创建一个文件test3.txt,并利用rz命令将其上传到服务器

10.将服务器上的文件下载到客户机

1)先在服务器上创建一个测试文件test4.txt

2)利用sz下载

在服务器创建一个文件test4.txt

[zhangsan@localhost ~]$echo  “aaaa”  >test4.txt

实验二:使用密钥对登录linux

1. 客户端wangwu使用密钥对,用zhangsan登录服务器

[root@localhost ~]# useradd wangwu

[root@localhost ~]# passwd wangwu

2.切换到wangwu

[root@localhost ~]# su   -   wangwu

3.创建密钥对

[wangwu@localhost ~]$ ssh-keygen  -t   ecdsa

4.将密钥对上传到192.168.1.1

[wangwu@localhost ~]$ ssh-copy-id -i  ~/.ssh/id_ecdsa.pub zhangsan@192.168.1.1

5.验证免密码登录

[wangwu@localhost ~]$ ssh   zhangsan@192.168.1.1

6.客户端用户wangwu,以zhangsan的身份向远程服务器上传文件test.txt

[zhangsan@localhost ~]$ exit

[wangwu@localhost ~]$ touch test.txt

[wangwu@localhost ~]$ scp test.txt zhangsan@192.168.1.1:/home/zhangsan

实验三:  练习tcpwrappers

1、服务器允许root登录

2、只允许192.168.1.2远程管理服务器

参考实验:

一、先给服务器设置一个主机名,以区分客户机与服务器

#vim   /etc/hostname

#reboot

二、修改服务器的ssh配置,允许root登录

#vim  /etc/ssh/sshd_config

#systemctl  restart  sshd

二 、设置服务器ssh免密登录(以root登录)

1、在客户机上为root用户创建密钥对

2、将root公钥上传到服务器的root公钥库里

3、在客户机验证免密登录服务器

三、在服务器上配置tcpwrappers策略,只允许192.168.1.2远程登录服务器

#vim  /etc/hosts.allow

#vim  /etc/hosts.deny

四、在客户机上测试远程登录

1、在192.168.1.2上可以远程登录

登录成功

2、将客户机地址临时改成192.168.1.3

然后在改ip地址

3、再次登录服务器失败

相关文章
|
7天前
|
域名解析 人工智能 Linux
|
18天前
|
Linux Go 开发工具
手机上跑 DeepSeek 智能体:开源安卓客户端 DSH Go 安装与使用指南
DSH Go 是一款开源安卓客户端,将 DeepSeek Harness 智能体引擎装进手机:免 Root、免 Termux,一键安装即用;支持本机运行(内置 Ubuntu+Node.js)或远程接管电脑会话;具备插话打断、过程折叠、屏幕操控、端到端加密分享等特色功能,真正实现智能体“口袋化”。
16775 62
|
16天前
|
人工智能
Google 提示「所在地区不可用」?进不去 Antigravity 或 Gemini,先查账号这个设置
进不去 Antigravity 或 Gemini,提示所在地区不可用?三步查清 Google 账号关联地区、官方更正表单理由选法与改区注意事项。
Google 提示「所在地区不可用」?进不去 Antigravity 或 Gemini,先查账号这个设置
|
1天前
|
人工智能 安全 网络安全
|
5天前
|
云安全 数据采集 人工智能
|
6天前
|
Linux API iOS开发
【DSH】DeepSeek Harness新手保姆教程(下载+安装+配置+使用,2026最新实测)
DeepSeek Harness(dsh)是 DeepSeek AI 开源的智能体框架,秉持“一切皆插件”理念,支持读文件、改代码、执行命令、处理表格等自动化任务;免费开源,兼容 Win/macOS,需配 API 密钥使用。(239字)
1201 2
|
13天前
|
人工智能 开发工具 开发者
2026最新codex下载安装保姆级使用教程(下载+安装+登录+使用,含所有历史版本)
Codex 是 OpenAI 推出的开源 AI 编程智能体,跑在本地终端和桌面客户端里,能读懂整个代码仓库,一句自然语言就能让它改代码、执行命令、跑测试、修 Bug,支持 Windows、macOS、Linux 三大平台。本文把 Codex下载、安装、登录、汉化、基础使用一次讲全,并整理了国内用户最常踩的坑,跟着做 10 分钟就能跑起来。
2280 7
|
18天前
|
弹性计算 人工智能 API
Codex超详细入门指南(下载·安装·登录·上手,全版本覆盖,2026最新版)
建议收藏本教程,2026 全年各版本更新随时回来查阅。如果你在搭建过程中遇到任何问题,欢迎结合 阿里云工单系统 提交技术支持请求,或在 阿里云开发者社区 搜索 Codex 相关话题交流。 祝你编码愉快,效率翻倍!
3775 22
|
19天前
|
Linux API iOS开发
【DSH】DeepSeek Harness新手保姆教程(下载+安装+配置+使用,2026最新实测)
DeepSeek Harness(dsh)是DeepSeek AI开源的智能体框架,秉持“一切皆插件”理念,支持读文件、改代码、跑命令、处理表格、联网搜索等操作。免费开源,兼容Windows/macOS/Linux,提供桌面端与网页端,可灵活安装插件扩展能力。