分享一个Linux无法创建文件夹,但是目录权限却显示正常的问题和解决
source link: https://zhang.ge/201.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
分享一个Linux无法创建文件夹,但是目录权限却显示正常的问题和解决
今天发现一个疑难杂症:发现批量发布一个新版本程序时,发现有一台没有成功。亲自登陆上去看了下,发现原来是发布帐号在某个目录下创建目录失败了!
人工 touch 试了下,发现提示没有权限。
然后 ls -l 看了下,发现一切正常:
奇了怪了啊,于是看下上层目录是否有权限,结果发现从/ 到 release 权限都是正常的!
最终,灵机一动,这个帐号是否可能是被删除过,后面又添加的呢???
先使用id 看了下这个用户信息:
然后,对没有权限的目录使用 ls -nd /data/TNM2/release
果然啊!这UID都对不上,如果不看UID还真不知道是什么原因呢!
既然知道怎么回事了,那就简单了。
使用 chmod 重新授权即可:chmod -R publish:users /data/TNM2/release
Ps:没有权限新建文件或修改文件其实还有其他一些因素,比如比较隐秘的“加锁”命令:chattr
感兴趣的可以看下:
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK