La racine ne peut pas supprimer le dossier dont elle est propriétaire

3

Plate-forme: CentOS 6.2 Coquille: tcsh


MODIFIER
Brian Swift a souligné une solution viable. Il souligne que si le répertoire de base est servi via NFS, root sur un client peut ne pas avoir les mêmes autorisations. Se connecter en tant que root sur le serveur NFS, le dossier est supprimé sans réclamation. Cela me laisse encore quelques questions sans réponse, cependant.

Contexte:

  1. J'ai créé ce fichier en tant que root env. Il y a 2 ans sur le même client, je essayé les commandes ci-dessous sur.
  2. Tous les autres root dossiers créés sur ce même client de cette même période (mi-2010) supprimé sans se plaindre.

Des questions:

  1. Ce qui fait de ce dossier un flocon de neige spécial par rapport à un autre client root créé des dossiers dans mon répertoire personnel?
  2. Existe-t-il un moyen de vérifier les autorisations NFS déviantes?

Encore une fois, je dois un grand merci à Brian pour avoir été au fond des choses, il est vraiment un super utilisateur!


Question ORIGINALE:

Je suis perdu quant à ce qui se passe ici dans le monde ... root est propriétaire de ce répertoire verrouillé (à partir d'un manuel gcc-4.4.3 installer) dans mon répertoire personnel. Je change pour root ( su root, a également essayé su ) et essayez de le supprimer et d’obtenir des erreurs d’autorisations. J'essaie de changer les permissions, l'opération est refusée. Je tente de lsattr / chattr et obtenez des erreurs ioctl dans le terminal.


Pour être clair, je suis en train de nettoyer mon répertoire personnel, et j’ai pu supprimer tous les fichiers que je voulais, avec l’aide de root pirater les barrières de permissions, etc. C'est juste ce dossier qui donne du chagrin.

Voici ce que j'ai essayé ....

COMMANDER:

whoami


SORTIE

root

COMMANDER:

 rm -rf gcc-4.4.3_objdir


SORTIE

> gcc-4.4.3_objdir rm: cannot remove
    > `gcc-4.4.3_objdir/config.status': Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/x86_64-unknown-linux-gnu': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/intl/config.status': Permission denied
    > rm: cannot remove `gcc-4.4.3_objdir/intl/config.intl': Permission
    > denied rm: cannot remove `gcc-4.4.3_objdir/intl/config.cache':
    > Permission denied rm: cannot remove `gcc-4.4.3_objdir/intl/Makefile':
    > Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/intl/config.log': Permission denied rm: cannot
    > remove `gcc-4.4.3_objdir/intl/config.h': Permission denied rm: cannot
    > remove `gcc-4.4.3_objdir/libdecnumber/decNumber.o': Permission denied
    > rm: cannot remove `gcc-4.4.3_objdir/libdecnumber/gstdint.h':
    > Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/libdecnumber/config.status': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/libdecnumber/decimal128.o': Permission
    > denied rm: cannot remove `gcc-4.4.3_objdir/libdecnumber/decimal32.o':
    > Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/libdecnumber/decContext.o': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/libdecnumber/bid2dpd_dpd2bid.o':
    > Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/libdecnumber/host-ieee64.o': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/libdecnumber/decimal64.o': Permission
    > denied rm: cannot remove `gcc-4.4.3_objdir/libdecnumber/config.cache':
    > Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/libdecnumber/host-ieee32.o': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/libdecnumber/host-ieee128.o':
    > Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/libdecnumber/Makefile': Permission denied rm: cannot
    > remove `gcc-4.4.3_objdir/libdecnumber/libdecnumber.a': Permission
    > denied rm: cannot remove `gcc-4.4.3_objdir/libdecnumber/config.log':
    > Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/libdecnumber/stamp-h1': Permission denied rm: cannot
    > remove `gcc-4.4.3_objdir/libdecnumber/config.h': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/gcc/build/errors.o': Permission denied
    > rm: cannot remove `gcc-4.4.3_objdir/gcc/cstamp-h': Permission denied
    > rm: cannot remove `gcc-4.4.3_objdir/gcc/objc': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/gcc/config.status': Permission denied
    > rm: cannot remove `gcc-4.4.3_objdir/gcc/gthr-default.h': Permission
    > denied rm: cannot remove `gcc-4.4.3_objdir/gcc/options.h': Permission
    > denied rm: cannot remove `gcc-4.4.3_objdir/gcc/gccbug': Permission
    > denied rm: cannot remove `gcc-4.4.3_objdir/gcc/ada/Makefile':
    > Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/gcc/ada/gcc-interface/Makefile': Permission denied
    > rm: cannot remove `gcc-4.4.3_objdir/gcc/cs-bconfig.h': Permission
    > denied rm: cannot remove `gcc-4.4.3_objdir/gcc/tmp-modes.h':
    > Permission denied rm: cannot remove `gcc-4.4.3_objdir/gcc/java':
    > Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/gcc/auto-host.h': Permission denied rm: cannot
    > remove `gcc-4.4.3_objdir/gcc/doc': Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/gcc/bconfig.h': Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/gcc/.gdbinit': Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/gcc/tm.h': Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/gcc/objcp': Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/gcc/as': Permission denied rm: cannot remove
    > `gcc-4.4.3_objdir/gcc/config.cache': Permission denied rm: cannot
    > remove `gcc-4.4.3_objdir/gcc/optionlist': Permission denied rm: cannot
    > remove `gcc-4.4.3_objdir/gcc/configargs.h': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/gcc/s-options': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/gcc/Make-hooks': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/gcc/s-options-h': Permission denied
    > rm: cannot remove `gcc-4.4.3_objdir/gcc/Makefile': Permission denied
    > rm: cannot remove `gcc-4.4.3_objdir/gcc/cp': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/gcc/collect-ld': Permission denied rm:
    > cannot remove `gcc-4.4.3_objdir/gcc/nm': Permission denied rm: cannot
    > remove `gcc-4.4.3_objdir/gcc/config.log': Permission denied rm: cannot
    > remove `gcc-4.4.3_objdir/gcc/config.h': Permission denied rm: cannot
    ...

COMMANDER:

ls -laFd gcc-4.4.3_objdir

SORTIE

drwxr-xr-x. 10 root root 4096 Mar 19  2010 gcc-4.4.3_objdir/

COMMANDER:

id

SORTIE

uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:###########

COMMANDER:

chown -R root:root gcc-4.4.3_objdir

SORTIE

chown: changing ownership of `gcc-4.4.3_objdir/gcc/build': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/gcc/cstamp-h': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/gcc/objc': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/gcc/config.status': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/gcc/gthr-default.h': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/gcc/options.h': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/gcc/gccbug': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/gcc/ada/Makefile': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/gcc/ada/gcc-interface/Makefile': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/gcc/ada/gcc-interface': Operation not permitted
...
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/libiberty': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/fixopts.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/config.status': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/fixinc.sh': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/fixincl.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/mkheaders.almost': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/mkheaders': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/fixincl': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/server.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/fixlib.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/fixtests.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/procopen.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/full-stamp': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/Makefile': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/config.log': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/stamp-h': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/config.h': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes/fixfixes.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/fixincludes': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu/config.cache': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/stage_final': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/stage_current': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/Makefile': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/config.status': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/line-map.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/lex.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/identifiers.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/symtab.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/mkdeps.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/makedepend': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/pch.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/localedir.h': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/directives.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/config.cache': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/makedepend.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/localedir.hs': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/traditional.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/init.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/charset.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/Makefile': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/libcpp.a': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/directives-only.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/errors.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/makedepend.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/pch.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/charset.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/line-map.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/mkdeps.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/symtab.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/files.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/directives-only.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/directives.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/expr.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/init.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/identifiers.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/lex.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/traditional.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps/macro.Po': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/.deps': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/macro.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/config.log': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/expr.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/stamp-h1': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/files.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/config.h': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp/errors.o': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/libcpp': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/stage_last': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir/config.log': Operation not permitted
chown: changing ownership of `gcc-4.4.3_objdir': Operation not permitted

COMMANDER:

stat gcc-4.4.3_objdir

SORTIE

  File: `gcc-4.4.3_objdir'
  Size: 4096        Blocks: 8          IO Block: 8192   directory
Device: 1ch/28d Inode: 36835590    Links: 10
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2012-04-24 04:04:17.251456720 -0400
Modify: 2010-03-19 18:23:51.000000000 -0400
Change: 2012-04-20 12:02:38.334456000 -0400

COMMANDER:

chattr -i gcc-4.4.3_objdir

SORTIE

chattr: Inappropriate ioctl for device while reading flags on gcc-4.4.3_objdir

COMMANDER:

lsattr gcc-4.4.3_objdir

SORTIE

lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/config.status
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/x86_64-unknown-linux-gnu
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/intl
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/libdecnumber
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/gcc
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/serdep.tmp
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/libiberty
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/zlib
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/build-x86_64-unknown-linux-gnu
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/stage_final
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/stage_current
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/Makefile
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/libcpp
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/stage_last
lsattr: Inappropriate ioctl for device While reading flags on gcc-4.4.3_objdir/config.log
Jason R. Mick
la source
Juste une supposition aléatoire: c'est un système de fichiers en lecture seule à cause d'un montage de feuille ou autre. Vérifiez la sortie de "mount".
Gregory MOUSSAT
@GregoryMOUSSAT Résultats de mount gcc-4.4.3_objdir: mount: can't find gcc-4.4.3_objdir in /etc/fstab or /etc/mtab; Resultats de mount /dev/mapper/vg_<MACH_NAME>-lv_root on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") /dev/sda1 on /boot type ext4 (rw) /dev/mapper/vg_<MACH_NAME>-lv_home on /home type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) <CENSORED HOME>
Jason R. Mick
@GregoryMOUSSAT Le répertoire ne semble pas figurer dans la liste des répertoires montés et tente de le monter (vous ne savez pas pourquoi vous le feriez, mais je ne savais pas si vous vouliez le faire ou simplement obtenir le mount liste) ne fonctionne pas non plus.
Jason R. Mick
Cela pourrait avoir un sens si le répertoire venait d’un serveur NFS ou d’une autre forme de NAS. Selon la configuration du serveur, il est possible que la racine du client ne puisse pas supprimer de fichiers et que le serveur ne prenne pas en charge les attributs de fichier.
Brian Swift
@BrianSwift Hypothèse intéressante ... Home est sur un serveur NFS ... Je vais essayer de le supprimer ici. En règle générale, root peut supprimer tout ce qui se trouve dans mon répertoire personnel sur un client. Il s’agit donc d’une exception étrange. Une idée de la raison pour laquelle il y aurait une exception spéciale pour un dossier spécifique sur un client et / ou comment vérifier cela
Jason R. Mick

Réponses:

3

Cela pourrait avoir un sens si le répertoire venait d’un serveur NFS ou d’une autre forme de NAS. Selon la configuration du serveur, il est possible que la racine du client ne puisse pas supprimer de fichiers et que le serveur ne prenne pas en charge les attributs de fichier.

Pour expliquer pourquoi seul ce répertoire a eu des problèmes, je vais simplement spéculer sur le fait que la configuration de NFS (ou le logiciel client ou serveur NFS) a changé de manière pertinente quelque temps après la création du répertoire. J'aurais été curieux si ls -l a montré sur la propriété du serveur était root, votre nom d'utilisateur, ou nobody.

Une spéculation supplémentaire, si ce répertoire a été créé en supprimant la tarage d’une distribution gcc en tant que racine, peut-être qu’il récupérait des droits de propriété / autorisations géniaux dans l’archive tar, plutôt que des répertoires et des fichiers créés directement.

Brian Swift
la source
Merci encore! (la propriété sur le serveur était root, le même que sur le client... fwiw)
Jason R. Mick
0

Avez-vous essayé de supprimer le répertoire avec votre propre compte?

Lorsque vous supprimez un fichier ou un répertoire, vous modifiez en fait le répertoire parent de ce fichier (tout est un fichier sous linux, même un répertoire). Et vous avez les autorisations pour modifier votre répertoire personnel.

Une autre chose à vérifier est SELinux, lancez /usr/sbin/getenforce, s’il est indiqué "Enforcing", vous pouvez essayer de désactiver SELinux temporairement /usr/sbin/setenforce 0 ou vérifiez les paramètres SElinux ls -lZ gcc-4.4.3_objdir et utilise /sbin/restorecon -R /home/<username>/ pour les corriger.

Bram
la source
Théorie intéressante ... tristement basculer vers permissive via echo 0 >/selinux/enforce (J'ai vérifié permissive était en vigueur.) n'a rien fait ... a toujours le même Permission denied les erreurs.
Jason R. Mick
0

Cela devrait supprimer ce fichier ou ce dossier:

chmod -Rf 777 your_folder_or_file_name

rm -rf your_folder_or_file_name
AlexB
la source