zzw原创_解决Could not chdir to home directory /test/bdctool: Permission denied一例
1、用命令新建一用户 adduser -d /test/bdctool -m bdctool
2、用新用户登录,报错:Could not chdir to home directory /test/bdctool: Permission denied
Last login: Wed Apr 11 17:43:27 2018 from 10.1.26.41
Could not chdir to
home directory /test/bdctool: Permission denied
3、但是同样一台机器,有的用户可以正常登录,却没有报这个错。比如用户sims20(其home目录为/opt/aspire/product/sims20)
4、查了一下资料,大约是与SELINUX相关
5、看一下可以正常登录及会报错用户的home目录的安全上下文
[root@sv09135 test]# ls -Z -d /opt/aspire/product/sims20
drwxrwxrwx.
sims20 sims20 system_u:object_r:usr_t:s0 /opt/aspire/product/sims20
[root@sv09135 test]# ls -Z -d /test/bdctool
drwx------. bdctool bdctool
system_u:object_r:default_t:s0 /test/bdctool
还是有区别的,出问题的类型为default_t,而正常的却是usr_t
6、改一下吧,将出问题的也改为usr_t
[root@sv09135 test]# chcon -t usr_t /test/bdctool
查一下,改过来了
[root@sv09135 test]#
ls -Z -d /test/bdctool
drwx------. bdctool bdctool
system_u:object_r:usr_t:s0 /test/bdctool
7、再次用bdctool用户以SSH方式登录,问题还在,没解决
Last login: Wed Apr 11 17:44:45 2018 from 10.1.26.41
Could not chdir to
home directory /test/bdctool: Permission denied
[bdctool@sv09135 /]$
8、看一下正常用户sims20用户家目录所有上级目录的安全上下文件
[root@sv09135 test]# ls -Z -d /opt /opt/aspire
/opt/aspire/product
drwxr-xr-x. root root system_u:object_r:usr_t:s0
/opt
drwxrwxrwx. root root unconfined_u:object_r:usr_t:s0
/opt/aspire
drwxrwxrwx. root root unconfined_u:object_r:usr_t:s0
/opt/aspire/product
都是usr_t
9、再看一下出问题的bdctool用户的所有上级目录的安全上下文
[root@sv09135 test]# ls -Z -d /test /test/bdctool
drwxr-xr-x. root
root system_u:object_r:default_t:s0
/test
drwx------. bdctool bdctool system_u:object_r:usr_t:s0
/test/bdctool
上级目录还是default_t
10、将上级目录test目录也改也下吧
[root@sv09135 test]# chcon -t usr_t /test
查一下,修改成功了
[root@sv09135 test]# ls -Z -d /test /test/bdctool
drwxr-xr-x. root
root system_u:object_r:usr_t:s0
/test
drwx------. bdctool bdctool system_u:object_r:usr_t:s0
/test/bdctool
11、再次用bdctool用户以SSH方式登录,问题解决了,原来从根目录开始每一级目录都要改
Last login: Wed Apr 11 17:55:17 2018 from 10.1.26.41
[bdctool@sv09135 ~]$
zzw原创_解决Could not chdir to home directory /test/bdctool: Permission denied一例的更多相关文章
- Could not chdir to home directory /home/USER: Permission denied
Could not chdir to home directory /home/USER: Permission denied 2 years ago davidzhang We changed t ...
- zzw原创_非root安装fastDFS
zzw原创_非root安装fastDFS fastDFS 想要非root安装,没找到资料,分析了一下安装脚本,原来作者是留了安装路径的,但没有放出来. 1.解包 [bdc@svr001 setup]$ ...
- zzw原创_非root用户下安装nginx
想自己安装nginx,又不相用到root用户. 非root用户下(本文为用户bdctool)来ngnix安装,要依赖pcre库.zlib库等, 1. 下载依赖包:下载地址 pcre(www.pcre. ...
- 解决使用Qt creator时出现Cannot overwrite file ..Permission denied
前两天在linux下使用Qt creator, 切换到了管理员使用了Qt creator后,再切换为普通用户,发现出现了 Cannot overwrite file ..Permission deni ...
- zzw原创_非root用户启动apache的问题解决(非root用户启动apache的1024以下端口)
场景:普通用户编译的apache,要在该用户下启动1024端口以下的apache端口 1.假设普通用户为sims20,用该用户编译 安装了一个apache,安装路径为/opt/aspire/produ ...
- zzw原创_根据某一文件复制出大量固定位数后缀名的递增的文件
1.trre.sh :根据某一文件复制出大量固定位数后后缀递增的文件. 如将 SPINFO_190516_20170109.001 复制成SPINFO_190516_20170109.002 ...
- 解决Ubuntu的root账号无法登录SSH问题-Permission denied, please try again.
http://www.cnblogs.com/yixius/articles/6971054.html
- zzw原创_expdp及impdp中的exclude及include参数的那点事
zzw原创:转载请注明出处 在oracle的expdp 及imdpd命令中,exclude及include参数还是有一些要注意的地方,特别是涉及选择性条件时. 一.通用 1.exclude及inclu ...
- Nginx分时段限制下载速度解决方案(原创)_于堡舰_新浪博客
Nginx分时段限制下载速度解决方案(原创)_于堡舰_新浪博客 Nginx分时段限制下载速度解决方案(原创) (2011-03-02 16:40:49) 转载▼ 标签: ngi ...
随机推荐
- linux 通过pid 寻找程序路径的最简单命令(pwdx)
在linux实际操作命令中,查看pid的方式有很多种,通过pid找程序路径的方式也有好几个,但是可能大家都忽略的一个很简单也是很实用的命令:pwdx. 比如要查找某个java编写的程序运行情况可通过j ...
- [js]ajax-异源请求jsonp
参考: http://www.cnblogs.com/whatisfantasy/p/6237713.html http://www.cnblogs.com/freely/p/6690804.html ...
- 【LeetCode每天一题】Combinations(组合)
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. Example: I ...
- 发布自己的npm包、开源项目
背景:由于最近在做项目之余想做一些其他的事,所以东找找西找找的,最后决定写一个封装一些常用原型方法的NPM包,但不仅限于此.话不多说,说一下实践过程. 一.注册NPM及如何上传NPM包参考连接:htt ...
- caffe-ssd安装GPU版本和CPU的区别
在CPU中1.CPU_ONLY :=1的注释取消掉 2.BLAS := atlas 在GPU中 1.USE_CUDNN := 1的注释取消 2.BLAS := open
- kali蓝牙渗透
1.hcitool 通过前面讲的升级操作后,在BackTrack4 Linux或者Ubuntu系统下将会安装好蓝牙的全套操作工具,其中就包括hcitool.该工具支持大量的蓝牙设备操作,从扫描到查看设 ...
- 使用Sitecore的可视化路径分析器工具洞察客户360度行为
Path Analyzer背后的想法是观察,分析和理解您的潜在客户和客户在浏览您的网站时所遵循的网络旅程.他们最初来自哪里?他们的路径是“有机”(通过搜索引擎)还是来自付费广告?社交帖子?甚至是你发起 ...
- JavaScript 原型链学习(四)原型链的基本概念、原型链实现继承
简单回顾一下构造函数.原型和实例的关系:每个构造函数都有一个原型对象,原型对象都包含一个指向构造函数的指针,而实例都包含一个指向原型对象的内部指针.那么,假如我们让原型对象等于另一个类型的实例,结果会 ...
- 爬虫----requests模块
一.介绍 #介绍:使用requests可以模拟浏览器的请求,比起之前用到的urllib,requests模块的api更加便捷(本质就是封装了urllib3) #注意:requests库发送请求将网页内 ...
- 20190402Linux常用命令week1.1
Linux常用命令详解week1.1 基础命令:lsmanpwdcdmkdirechotouchcpmvrmrmdircatmorelessheadtailclearpoweroffreboot 命令 ...