日期:2014-05-16  浏览次数:20901 次

求解unix系统用root权限mkdir新文件夹,再用chown设权限成功,但是不能用!!!
今天用服务器root权限删掉了一个文件夹,然后用mkdir建了个新文件夹,再用chown设了权限,但是用设了有权限的用户进入服务器,不能打开文件夹。这是为什么? 用的命令:(ABC为新的文件夹名,a1234是用户名,abc是组别)
  mkdir ABC
  chown a1234:abc ABC
  chmod 0775 ABC
并且用ls -l查看其他文件夹(在同一文件夹下)的权限和ABC的文件夹权限一样,其他的都可以打开并且读写,但是这个文件夹就不行。请大神分析一下。

------解决方案--------------------
chown a1234:abc ABC

貌似应该没有空格吧
------解决方案--------------------
chown changes the user and/or group ownership of each given file. If only an owner (a user name or numeric user ID) is given, that user is made the owner of each given file, and the files' group is not changed. If the owner is followed by a colon and a group name (or numeric group ID), with no spaces between them, the group ownership of the files is changed as well. If a colon but no group name follows the user name, that user is made the owner of the files and the group of the files is changed to that user's login group.
------解决方案--------------------
还是看看具体的ls -l 的输出吧
然后看看你当前用户的身份,执行id 命令就能看到

然后再看看你说的不能打开文件夹是一个什么现象


都贴出来看看
------解决方案--------------------
C/C++ code

OPERANDS
       The following operands shall be supported:

       owner[:group]
              A user ID and optional group ID to be assigned to file. The owner portion of this operand shall be a user  name  from  the  user  database  or  a
              numeric  user  ID.  Either  specifies  a  user ID which shall be given to each file named by one of the file operands. If a numeric owner operand
              exists in the user database as a user name, the user ID number associated with that user name shall be used as the user  ID.  Similarly,  if  the
              group  portion  of  this  operand is present, it shall be a group name from the group database or a numeric group ID. Either specifies a group ID
              which shall be given to each file. If a numeric group operand exists in the group database as a group name, the group ID number  associated  with
              that group name shall be used as the group ID.

       file   A pathname of a file whose user ID is to be modified.