unit6.7.8.10.11

1.开启 Selinux 的作用

>给程序及程序里面的文件一个安全上下文

2.Selinux关闭时的状况

vim /etc/sysconfig/selinux

selinux 的配置文件

SELINUX=enforcing   selinux 开启

SELINUX=disabled    selinux 关闭

getenforce

查看 selinux 状态

[[email protected] linux1]# ls

file1  linux1file1  pub

[[email protected] linux1]# ls -Z

-rw-r--r-- root root ?                                file1

-rw-r--r-- root root ?                                linux1file1

drwxrwxr-x root root ?                                pub

[[email protected] linux1]#

7

测试:

lftp IP -u username

[[email protected] Desktop]$ lftp 172.25.254.130 -u linux1

Password:

lftp [email protected]:~> ls

-rw-r--r--    1 0        0               0 Feb 21 08:50 file1

-rw-r--r--    1 0        0               0 Feb 21 07:40 linux1file1

drwxrwxr-x    2 0        0               6 Feb 21 08:28 pub

#所有文件都可以访问到

lftp [email protected]:/> ls -Z

-rw-r--r--    1 0        0               0 Feb 21 08:50 file1

-rw-r--r--    1 0        0               0 Feb 21 07:40 linux1file1

drwxrwxr-x    2 0        0               6 Feb 21 08:28 pub

lftp [email protected]:/> exit

[[email protected] Desktop]$

3.Selinux 开启时

[[email protected] pub]# ls

file1  linux  linux1

[[email protected] pub]# ls -Z

-rw-r--r--. root root unconfined_u:object_r:mnt_t:s0   file1

drwxr-xr-x. root root unconfined_u:object_r:mnt_t:s0   linux

-rw-r--r--. root root unconfined_u:object_r:public_content_t:s0 linux1

#不符合形式的文件访问不到

[[email protected] pub]#

测试:

[[email protected] Desktop]$ lftp 172.25.254.130

lftp 172.25.254.130:~> ls

drwxr-xr-x    3 0        0              43 Feb 21 09:07 pub

lftp 172.25.254.130:/> cd pub/

lftp 172.25.254.130:/pub> ls

drwxr-xr-x    2 0        0               6 Feb 21 09:04 linux

-rw-r--r--    1 0        0               0 Feb 21 09:05 linux1

lftp 172.25.254.130:/pub> exit

[[email protected] Desktop]$

4.Selinux对服务的影响

(1).不符合安全上下文的文件访问不到

(2).默认情况下不安全的功能是关闭的

getsebool -a | grep ftp     #查看 ftp 服务功能状态

setsebool -P ftp_home_dir on    #开启

-P:表示永久开启

本地用户默认有写权限

[[email protected] ~]# getsebool -a | grep ftp

`ftp_home_dir --> off`

[[email protected] ~]# lftp 172.25.254.130 -u student

Password:

lftp [email protected]:~> ls

-rw-r--r--    1 0        0               0 Feb 22 03:17 file2

drwxr-xr-x    2 0        0               6 Feb 22 01:36 linux1

lftp [email protected]:~> cd linux1/

lftp [email protected]:~/linux1> put /etc/passwd

put: Access failed: 553 Could not create file. (passwd)

lftp [email protected]:~/linux1> exit

[[email protected] ~]# lftp 172.25.254.130 -u student

[[email protected] ~]# setsebool -P ftp_home_dir on

[[email protected] ~]# getsebool -a | grep ftp

ftp_home_dir --> on

[[email protected] ~]# lftp 172.25.254.130 -u student

Password:

lftp [email protected]:~> ls

-rw-r--r--    1 0        0               0 Feb 22 03:17 file2

drwxr-xr-x    2 0        0               6 Feb 22 01:36 linux1

lftp [email protected]:~> put /etc/passwd

2367 bytes transferred

lftp [email protected]:~> exit

[[email protected] ~]#

5.Selinux 日志存放位置

cat /var/log/audit/audit.log #默认位置

setroubleshoot-server.x86_64

###可以将/var/log/audit/audit.log里面的日志经过处理存放到/var/log/messages

[[email protected] ~]# yum search setroubleshoot

Loaded plugins: langpacks

========================= N/S matched: setroubleshoot ==========================

setroubleshoot-plugins.noarch : Analysis plugins for use with setroubleshoot

setroubleshoot.x86_64 : Helps troubleshoot SELinux problems

setroubleshoot-server.x86_64 : SELinux troubleshoot server

Name and summary matches only, use "search all" for everything.

[[email protected] ~]# yum install setroubleshoot-server.x86_64  -y

cat /var/log/audit/audit.log

cat /var/log/messages

unit7

1.网络文件系统

如何访问

1)yum install samba-client

2)smbclient -L //ip

3)smbclient //ip/sharename

如何访问

mount //ip/sharename /mountpoint -o username=guest

vim /etc/fstab

//ip/sharename /mountpoint cifs defaults,username=guest 0 0

mount -a

5.NFS如何共享

1)yum       install      nfs-utils       -y

2)vim       /etc/exports

/mnt  *(rw)     ##共享/mnt 所有人可以访问(权限)

3)exportfs  -rv

4)systemctl restart nfs-server

6.NFS如何访问

6.1手动挂载

1)yum        install    nfs-utils   -y       ##安装NFS软件

2)showmount  -e     ip      ##显示共享的目录

3)mount     ip:/sharedir     /mountpoint     ##挂载共享目录到本机

这里写图片描述

6.2自动挂载

1)yum install autofs        ##安装软件

2)systemctl start autofs    ##开启服务

3)cd /net/ip/                   ##进入共享目录

4)vim /etc/autofs.conf      ##修改自动卸载时间单位(妙)

TIMEOUT=5

6.3自定义挂载方式

mkdir       /nfs/nfs1       ##创建自定义挂载目录

vim /etc/auto.master最终挂载点的上层目录  自策略文件

/nfs            /etc/auto.nfs

vim 自策略文件(vim /etc/auto.nfs)

最终挂载点   网络挂载资源

nfs1        172.25.254.250:/nfsshare/nfs1

*       172.25.254.250:/nfsshare/&

进入nfs1 则自动挂载到nfs1, *和&任意匹配

systemctl restart autofs            ##重启服务

cd /nfs/nfs1

unit11系统恢复技术

2.1密码忘记,修改root用户密码

重启,到grub选项菜单,按’e’进入编辑模式。

找到kernel命令行编辑如下图

得到一个shell

 chroot /sysroot/

passwd root

touch /.autorelabel

按两下ctlr+d或输入两次exit退出重启就可以正常登陆了。

2.2grub文件引导阶段文件丢失

如果/boot/grub2/grub.cfg引导文件丢失,则如图

输入这四条命令,就会重启

进入系统后,在shell输入命令生成缺失的引导文件,系统就修复成功!

grub2-mkconfig >/boot/grub2/grub.cfg

2.3内核文件丢失

如果系统内核文件丢失,则重启时会如图所示

关机,选择镜像启动<这里用虚拟机做实验>

进入界面选择“Rescue Red Hat Enterprise Linux system”

选择“Troubleshooting”

进入挽救模式,“chroot /mnt/sysimage”

得到一个shell,执行刚才的命令,重新安装内核安装包

chroot /mnt/sysimage        ##切换到真实根环境

yum install kernel -y       ##安装内核安装包

按两下ctlr+d或输入两次exit退出,关掉镜像启动,开启硬盘启动,就可以正常登陆。

2.4 initramfs-‘uname- r’.img文件丢失

chroot /mnt/sysimage        ##切换到真实根环境

cd /boot/                       ##进入boot目录

mkinitrd initramfs-`uname -r`.img  `uname -r`

uname -r                        ##内核版本号

按两下ctlr+d或输入两次exit退出,关掉镜像启动,开启硬 盘启动,就可以正常登陆。

2.5误删shell文件,系统恢复

设置镜像启动,进入挽救模式,得到一个shell。

由于/bin/bash文件缺失,无法使用shell,

cp       /bin/bash /mnt/sysimage/bin/bash

cp       /bin/bash /mnt/sysimage/bin/bash

按两下ctlr+d或输入两次exit退出,关掉镜像启动,开启硬 盘启动,就可以正常登陆。

2.6系统启动级别文件链接错误

/etc/systemd/system/default.target      ##系统开机链接文件

启动级别共6级

当default.target 链接到别的级别,则系统无法启动到图形界面

default.target -> /lib/systemd/system/graphical.target

这里,systemctl set-default poweroff.target    使其链接为0级别。

则,系统开机就会自动关机。

置镜像启动,进入挽救模式,得到一个shell。输入如下命令。

chroot /mnt/sysimage        ##切换到真实根环境

Rm -fr /etc/systemd/system/default.target

删除错误链接文件

Ln  -s  /usr/lib/systemd/system/graphical.target

etc/systemd/system/default.target       ##建立新的链接文件

按两下ctlr+d或输入两次exit退出,关掉镜像启动,开启硬 盘启动,就可以正常登陆。

时间: 2024-10-10 18:47:52

unit6.7.8.10.11的相关文章

解决mac 10.11 以后 无法使用未签名第三驱动

解决 最新版 mac 系统 无法使用未签名第三驱动 10.12.多 我的情况是 10.11.4 Beta (15E27e) 使用绿联usb网卡不正常. 下面的命令为检测驱动是否装载的一些命令.sudo kextload /Library/Extensions/AX88772.kext 报错: failed to load - (libkern/kext) not found; check the system/kernel logs for errors or try kextutil(8).

更新到10.11后 cocoapods 重装问题

更新到10.11后 cocoapods 需要重新安装,但是使用原来的淘宝源(http://ruby.taobao.org/) 会报错 ERROR:  Could not find a valid gem 'cocospods’ (>= 0), here is why: Unable to download data from http://ruby.taobao.org/ - bad response Not Found 404 (http://ruby.taobao.org/latest_sp

Windows下虚拟机安装Mac OS X &mdash;&ndash; VM12安装Mac OS X 10.11

______________________________________________________________________________________________________________________________________________________________________________________________________________________ 注:本文来源:csdn:N的专栏.<Windows下虚拟机安装Mac

在 Win 7或8 下使用 VirtualBOX 虚拟机安装 OS X 10.11 El Capitan 及 Xcode 7.0

注:本文源自于: http://bbs.feng.com/read-htm-tid-9908410.html __________________________________________________________________________________________________________________________________________________________________________________________ 欢迎加入iOS

Windows下 VM12虚拟机安装OS X 10.11 和VM TOOLS

Windows下虚拟机安装Mac OS X —– VMware Workstation12安装Mac OS X 10.11 本文即将介绍WIN虚拟MAC的教程.完整详细教程(包含安装中的一些问题) [并且适用其他mac os x版本] Windows下 VM12虚拟机安装OS X 10.11(详细教程) (图挂了的话,请点击此处.本人在百度发的) 工具/原料 Mac OS X 10.11 镜像文件(链接:http://pan.baidu.com/s/1pL8HE59 密码:cq4d) unloc

cocoapods 在10.11下运行pod命令报-bash: pod: command not found

系统是10.11,在运行pod命令是报:-bash: pod: command not found,于是开始找办法解决. 先试了试第一种方案. sudo gem install -n /usr/local/bin cocoapods 运行成功,但还是会报command not found 不得已再试另一种方法. $ mkdir -p $HOME/Software/ruby $ export GEM_HOME=$HOME/Software/ruby $ gem install cocoapods

VMware 12安装Mac OS X 10.11

去年写了一篇安装Mac OS X 10.10的文章,看到大家都想体验OS X,大多数都能成功,但也在其中发现了一些问题,所以更新一下,希望对大家有所帮助. 1048VMware 11安装Mac OS X 10.10 工具/原料 1. VMware Workstation 2. unlocker 206(for OS X 插件补丁) 3. Mac OS X 10.11镜像 步骤一 1 下载以上文件: 1. VM百度一下版本无所谓了,都能满足需要: 2. unlocker 206       链接:

黑苹果教程(四)———MAC OS 10.11+固态硬盘+自定义引导

为了使黑苹果的体验效果更佳,楼主购买了一块固态硬盘,为了黑苹果还把主板搞出问题了,,哎,方法没有掌握好,为了今后的同志少走弯路,同时给自己留个笔记,所以分享一下自己的经验. 楼主黑苹果也经历了三个版本了,有了自己的一点点经验,10.9->10.10->10.11.程序员总有这种尝试新东西的想法,而不是每天都敲着代码,尝试新系统感觉很不错.先来分享一下最新的10.11最终效果. 截图: 总况: 亮度调节: 声音调节: cpu变频: 声卡.USB2.0.USB3.0.相机.电源电量显示.网卡均ok

10.11 安装pod

原文地址:http://www.jianshu.com/p/5fc15906c53a  感谢. 更新升级10.11 cocoapods安装出问题最简单的解决方法 这是因为10.11把cocoapods直接干掉了 sudo gem install -n /usr/local/bin cocoapods 再加一句,完美解决 sudo xcode-select --switch /Applications/Xcode.app 使用CocoaPods做依赖管理,使我们的工程更加自动化的.集中的.简单直观