linux课后习题(2)

<<<第九单元练习>>>
1.在desktop主机中建立用户westos,并设定其密码为westoslinux
2.配置desktop中的sshd服务要求如下:
*)设定sshd服务只允许westos用户可以被访问使用
*)创建westos用户的key认证方式
*)设定westos用户只允许使用key认证方式,屏蔽其系统密码认证方式

1.
[[email protected] Desktop]# useradd westos
[[email protected] Desktop]# passwd westos
Changing password for user westos.
New password:
BAD PASSWORD: The password contains the user name in some form
Retype new password:
passwd: all authentication tokens updated successfully.
2.
(1)[[email protected] Desktop]# vim /etc/ssh/sshd_config
AllowUsers westos
:wq

(2)[[email protected] Desktop]# su - student
[[email protected] ~]$ su - root
Password:
Last login: Sun Oct  9 09:34:57 EDT 2016 on :0
[[email protected] ~]# su - westos
[[email protected] ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/westos/.ssh/id_rsa):
Created directory ‘/home/westos/.ssh‘.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/westos/.ssh/id_rsa.
Your public key has been saved in /home/westos/.ssh/id_rsa.pub.
The key fingerprint is:
f8:2d:1d:7d:37:58:01:47:c5:b6:fc:59:e3:09:30:e5 [email protected]
The key‘s randomart image is:
+--[ RSA 2048]----+
|            .oo=o|
|           o. . +|
|            oE.o.|
|       .   . .o+.|
|      . S . ..+.B|
|       . o . . =o|
|        o o      |
|         .       |
|                 |
+-----------------+

[[email protected] ~]$ ssh-copy-id -i /home/westos/.ssh/id_rsa.pub  [email protected]
The authenticity of host ‘172.25.254.27 (172.25.254.27)‘ can‘t be established.
ECDSA key fingerprint is 9f:9f:8d:cf:8c:f2:ae:b4:da:fa:71:c9:56:3c:82:28.
Are you sure you want to continue connecting (yes/no)? yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]‘s password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh ‘[email protected]‘"
and check to make sure that only the key(s) you wanted were added.

[[email protected] ~]$ scp /home/westos/.ssh/id_rsa [email protected]:/root/.ssh
id_rsa                                        100% 1679     1.6KB/s   00:00   
[[email protected] ~]$ ssh [email protected]
Last login: Sun Oct  9 22:05:52 2016
[[email protected] ~]#
(3)
vim /etc/ssh/sshd_config
PermitRootLogin  no

<<<第十二单元练习>>>
1.在server主机中把/etc目录打包压缩到/mnt中,名字为etc.tar.gz
2.复制server主机中的etc.tar.gz到desktop主机的/mnt中
3.同步server主机中的/etc中的所有文件到desktop主机中/mnt中,包含链接文件

1.
tar zcf /mnt/etc.tar.gz /etc
2.
scp /mnt/etc.tar.gz  [email protected]:/mnt
3.
rsync -lr /etc/ [email protected]:/mnt

时间: 2024-07-28 14:54:53

linux课后习题(2)的相关文章

linux课后习题1

1. Unix 和 Linux之间有什么关系?答:     区别:       1 ) UNIX系统大多是与硬件配套的,对硬件要求苛刻,而Linux则可运行在多种硬件平台上.       2)UNIX是商业软件,核心并不公开,而Linux是自由软件,免费.公开源代码的.       3)安装上linux比unix容易掌握,在使用上,linux相对没有unix那么复杂.       4 )在性能上,linux没有unix那么全面,unix与硬件一起配套卖,主要用于高端应用或服务器系统,linux则

linux课后习题

<<<第一单元练习题>>>1.用student用户登陆系统图形界面2.打开一个bash3.修改student的密码,把密码更新成"T3st1ngtlme"(主机字母和数字)4.显示当前系统时间5.显示当前系统时间,显示格式为:"小时:分钟:秒 AM/PM"(AM/PM为上下午标识)6.显示"/usr/bin/clean-binary-files"的文件类型7.统计"/usr/bin/clean-bin

《鸟哥linux》--第十一章课后习题答案

1.在linux上可以找到哪些shell?哪个档案记录可用的shell?儿linux预设的shell是? 1./bin/bash,/bin/tcsh,/bin/csh 2./etc/shells 3.bash,亦即是/bin/bash 2.在shell环境下,有个提示符(prompt),他可以修改吗?要改什么?默认的提示符内容是? 可以修改,改PS1变量,这个PS1的变量默认的内容为:[\[email protected]\h\W]\$ 3.如何显示HOME这个变量 echo $HOME 4.如

课后习题1-2章

第一章课后习题 (1) linux的发展史 Linux 操作系统的诞生创始人林纳斯·托瓦兹.发展和成长过程始终依赖着五 个重要支柱:UNIX 操作系统.MINIX 操作 系统.GNU计划.POSIX 标准 和Internet 网络. 1981 年IBM公司推出微型计算机IBM PC. 1991年,GNU计划已经开发出了许多工具软件,最受期盼的GNU C编译器 已经出现,GNU的操作系统核心HURD一直处于实验阶段,没有任何可用性, 实质上也没能开发出完整的GNU操作系统,但是GNU奠定了Linu

问题 1018: C语言程序设计教程(第三版)课后习题6.8

/******************************************************************** @file Main.cpp @date 2017-05-12 @author Zoro_Tiger @brief 问题 1018: C语言程序设计教程(第三版)课后习题6.8 http://www.dotcpp.com/oj/problem1018.html *************************************************

问题 1041: C语言程序设计教程(第三版)课后习题9.8

/******************************************************************** @file Main.cpp @date 2017-05-28 22:02:55 @author Zoro_Tiger @brief 问题 1041: C语言程序设计教程(第三版)课后习题9.8 http://www.dotcpp.com/oj/problem1041.html ****************************************

问题 1040: C语言程序设计教程(第三版)课后习题9.6

/******************************************************************** @file Main.cpp @date 2017-05-28 21:57:02 @author Zoro_Tiger @brief 问题 1040: C语言程序设计教程(第三版)课后习题9.6 http://www.dotcpp.com/oj/problem1040.html ****************************************

问题 1042: C语言程序设计教程(第三版)课后习题9.10

/******************************************************************** @file Main.cpp @date 2017-05-28 22:10:10 @author Zoro_Tiger @brief 问题 1042: C语言程序设计教程(第三版)课后习题9.10 http://www.dotcpp.com/oj/problem1042.html ***************************************

问题 1023: C语言程序设计教程(第三版)课后习题7.2

/******************************************************************** @file Main.cpp @date 2017-05-20 22:05:39 @author Zoro_Tiger @brief 问题 1023: C语言程序设计教程(第三版)课后习题7.2 http://www.dotcpp.com/oj/problem1023.html ****************************************