系统相关
首页 > 系统相关> > 无法在Linux中更改文件权限

无法在Linux中更改文件权限

作者:互联网

这似乎是一个非常基本的问题,但是我无法在linux中更改文件权限.

我是root用户,如果我在已安装的linux的文件系统中复制相同的文件,则可以更改文件许可权.我无法更改保留在另一个分区上的文件/文件夹的权限.

请给我一个至少如何开始调试的术语,我也看不到任何错误.没有设置粘性位.
通过提供一些可用来调试此问题的步骤来帮助我.

这是df -h的输出

Filesystem                                              Size  Used Avail Use% Mounted on
rootfs                                                   46G   22G   22G  50% /
udev                                                     10M     0   10M   0% /dev
tmpfs                                                   393M  1.9M  391M   1% /run
/dev/disk/by-uuid/49c0f59c-9bb3-4755-8c1f-06da6159865e   46G   22G   22G  50% /
tmpfs                                                   5.0M     0  5.0M   0% /run/lock
tmpfs                                                   786M  944K  785M   1% /run/shm
/dev/sda2                                                46G   43G  1.3G  98% /home
/dev/sda6                                               278G  122G  157G  44% /media/056AFEAB51156F3F___
/dev/sda3                                                92G   16G   72G  18% /media/3a7cb05d-b822-4f3e-a330-da91013b605c_

ls -al的输出

drwx------ 1 prasenjit prasenjit     0 Oct 21 15:08 abi
drwx------ 1 prasenjit prasenjit  4096 Oct 21 15:08 art
drwx------ 1 prasenjit prasenjit  4096 Oct 21 15:08 bionic
drwx------ 1 prasenjit prasenjit     0 Oct 21 15:08 bootable
drwx------ 1 prasenjit prasenjit  4096 Oct 21 15:08 build
drwx------ 1 prasenjit prasenjit  4096 Oct 21 15:08 cts
drwx------ 1 prasenjit prasenjit  4096 Oct 21 15:08 dalvik
drwx------ 1 prasenjit prasenjit     0 Oct 21 15:08 developers
drwx------ 1 prasenjit prasenjit  4096 Oct 21 15:08 development
drwx------ 1 prasenjit prasenjit  4096 Oct 21 15:09 device
drwx------ 1 prasenjit prasenjit     0 Oct 21 15:09 docs
drwx------ 1 prasenjit prasenjit 36864 Oct 21 15:17 external

lsattr的输出:

lsattr: Inappropriate ioctl for device While reading flags on ./abi
lsattr: Inappropriate ioctl for device While reading flags on ./art
lsattr: Inappropriate ioctl for device While reading flags on ./bionic
lsattr: Inappropriate ioctl for device While reading flags on ./bootable
lsattr: Inappropriate ioctl for device While reading flags on ./build
lsattr: Inappropriate ioctl for device While reading flags on ./cts
lsattr: Inappropriate ioctl for device While reading flags on ./dalvik
lsattr: Inappropriate ioctl for device While reading flags on ./developers
lsattr: Inappropriate ioctl for device While reading flags on ./development
lsattr: Inappropriate ioctl for device While reading flags on ./device
lsattr: Inappropriate ioctl for device While reading flags on ./docs
lsattr: Inappropriate ioctl for device While reading flags on ./external

安装输出

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=210750,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=401948k,mode=755)
/dev/disk/by-uuid/49c0f59c-9bb3-4755-8c1f-06da6159865e on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=803880k)
/dev/sda2 on /home type ext4 (rw,relatime,data=ordered)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda6 on /media/056AFEAB51156F3F___ type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
/dev/sda3 on /media/3a7cb05d-b822-4f3e-a330-da91013b605c_ type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)

让我知道其他可以帮助我调试的命令.
任何帮助表示赞赏.

提前致谢

解决方法:

ntfs分区不支持linux文件权限.因此您不能更改权限.或者,您可以使用所需的权限集安装驱动器.

范例:

mount -t ntfs -o rw,auto,user,fmask=0022,dmask=0022 /dev/sda6 /mnt/ntfsDrive/

在这里,我的分区格式是ntfs,所以我提到了它,当您创建任何文件或文件夹以及现有文件夹时,rw是读/写权限,fmask和dmask是默认文件和目录权限.假设您提到0022,这意味着将使用755创建该文件,并且文件夹也将创建该文件.
其余2个字段是“ / dev / sda6”是我的设备,它安装在名为“ / mnt / ntfsDrive /”的文件夹中.

您仍然将无法更改文件/文件夹权限,并且与安装驱动器(fmask和dmask)时所提到的相同.

如果有任何错误,请更正.

请参考:https://askubuntu.com/questions/11840/how-do-i-use-chmod-on-an-ntfs-or-fat32-partition

标签:debian-based,linux
来源: https://codeday.me/bug/20191029/1956930.html