linux课后习题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux课后习题相关的知识,希望对你有一定的参考价值。
<<<第九单元练习>>>
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
以上是关于linux课后习题的主要内容,如果未能解决你的问题,请参考以下文章
《Linux系统管理与应用》课程知识点整理+书后习题全文解答(Linux知识点大纲)