装了fedora23后定时关机:sudo shutdown -h +60

  弹出如下信息后立刻就关机了:

Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: Access denied
  
  
  Google一下,问题出在selinux。看下日志:
journalctl | grep -i avc

  找到问题所在:

Nov  :: RedBase audit[]: AVC avc:  denied  { create } for  pid= comm="systemd-logind" name=".#scheduledKNqxuo" scontext=system_u:system_r:systemd_logind_t:s0 tcontext=system_u:object_r:init_var_run_t:s0 tclass=file permissive=

  在/var/log/audit/audit.log中也找到相应信息:

# sudo audit2why < /var/log/audit/audit.log
type=AVC msg=audit(1448512017.541:): avc:  denied  { create } for  pid= comm="systemd-logind" name=".#scheduledKNqxuo" scontext=system_u:system_r:systemd_logind_t:s0 tcontext=system_u:object_r:init_var_run_t:s0 tclass=file permissive=

    Was caused by:
Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access.

  那我们就使用audit2allow来生成相应模块来解决这个问题吧:

# cd /etc/selinux/targeted/policy
# grep systemd-logind /var/log/audit/audit.log | audit2allow -M mypol
# sudo semodule -i mypol.pp

  搞定,这样在当前目录下就生成了两个文件:mypol.pp  mypol.te,看看:

# vim mypol.te

#============= systemd_logind_t ==============
allow systemd_logind_t init_var_run_t:file create;

  试验一下:

# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version:
# shutdown -h +
Shutdown scheduled for Mon -- :: CST, use 'shutdown -c' to cancel.

  Bingo!这样以后晚上工作没完成时,就可以让我的电脑多加一下班啦 :)

Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: Access denied的更多相关文章

  1. CDbConnection failed to open the DB connection: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

    连接mysql出错:CDbConnection failed to open the DB connection: SQLSTATE[28000] [1045] Access denied for u ...

  2. mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: YES)'

    就当作自己忘记Mysql密码把,忘记密码的解决方法 一.mysql登录错误mysqladmin: connect to server at 'localhost' failederror: 'Acce ...

  3. TortoiseGit拉取或推送,输入账号密码后提示 HTTP Basic: Access denied fatal: Authentication failed 解决方案

    TortoiseGit拉取或推送项目,输入账号密码后,提示 HTTP Basic: Access denied fatal: Authentication failed. 大体意思是,HTTP基本认证 ...

  4. git Remote: HTTP Basic: Access denied Git failed with a fatal error.

    解决方案: git clone 项目失败,报下面的错误信息: $ git clone http://192.168.0.141/xxxx.git Cloning into 'appEnterprise ...

  5. service mysqld start,Failed to start mysqld.service: Access denied

    service mysqld start 然后报: ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===Authentic ...

  6. 三星笔记本安装系统时报错:image failed to verify with * access denied* press any key to continue.

    安装系统从光盘启动报错: 出现黑屏,并且有一个提示框image failed to verify with *access denied*press any key to continue 原因:三星 ...

  7. TortoiseGit拉取或推送项目提示 HTTP Basic: Access denied fatal: Authentication failed.

      TortoiseGit拉取或推送项目提示 HTTP Basic: Access denied fatal: Authentication failed. 大体意思是,HTTP基本认证失败,访问被拒 ...

  8. xamarin调试android部署到模拟器错误记录:Deployment failed Mono.AndroidTools.InstallFailedException: Unexpected install output: Error: Could not access the Package Manager. Is the system running?

    问题记录: 1.生成 ok. 2.昨天也是能部署到模拟器的. 但是今天部署的时候就报了这样的一个错误 Deployment failed Mono.AndroidTools.InstallFailed ...

  9. remote: http basic: access denied fatal: authentication failed for '‘解决办法

    问题描述 由于这个项目代码使用https 进行clone,为什么?因为代码库ssh有问题!fuck! 导致在push代码的时候出现了 remote: http basic: access denied ...

随机推荐

  1. 初识Hibernate之继承映射

         前面的两篇文章中,我们介绍了两张表之间的各种相互关联映射关系,但往往我们也会遇到两张表甚至多张表之间共有着多个相同的字段.例如: 如图,student表和teacher表共同具有id,nam ...

  2. jQuery和AngularJS的区别

    这篇文章主要介绍了jQuery和AngularJS的区别浅析,本文着重讲解一个熟悉jQuery开的程序员如何应对AngularJS中的一些编程思想的转变,需要的朋友可以参考下   最近一直在研究ang ...

  3. ftpclient 550 permission denied

    遇到一个坑,ftp服务器有主被动模式,如果ftpclient 没有设置模式,默认就是主动模式,如果ftp服务器是被动模式,那么使用ftpclient就执行上传和下载,就会失败, 添加ftpClient ...

  4. win10 UWP 标题栏后退

    设置里,标题栏有后退按钮 在win平板,可以有后退键,手机也有 pc可以在标题栏 在OnLaunched //最后 Windows.UI.Core.SystemNavigationManager.Ge ...

  5. 张高兴的 Windows 10 IoT 开发笔记:HC-SR04 超声波测距模块

    HC-SR04 采用 IO 触发测距.下面介绍一下其在 Windows 10 IoT Core 环境下的用法. 项目运行在 Raspberry Pi 2/3 上,使用 C# 进行编码. 1. 准备 H ...

  6. LeetCode 202. Happy Number (快乐数字)

    Write an algorithm to determine if a number is "happy". A happy number is a number defined ...

  7. LeetCode 81. Search in Rotated Sorted Array II(在旋转有序序列中搜索之二)

    Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this ...

  8. YY表行推荐十块顶级复刻表,一比一开模复刻,外观堪比正品

    随着国内制表工艺的逐渐提升,顶级复刻表的行列里成员越来越多,今天复刻表工厂就总结一下最值得入手的十款顶级复刻表来和大家分享. TOP 10:爱彼 AP15400购买指数★★★ AP15400采用顶级复 ...

  9. 关于js赋值给input解析

    <script type="text/javascript"> //关于js中取值问题 $(function(){ //定义function函数 var firstDa ...

  10. 4天精通arcgis

    真是掉进了一个史无前例的坑 --ArcGIS产品线为用户提供一个可伸缩的,全面的GIS平台. 这是百科的介绍,简单来讲,这就是一个地图,可以搞事情. 学的是ArcGIS API for JavaScr ...