Find the answer to your Linux question:
Results 1 to 6 of 6
Hello all, thanks for reading a newbie post. TL;DR: I am trying to solve permission errors running df as root. System CentOS 4.9 bash shell So, my /var directory is ...
  1. #1
    kit
    kit is offline
    Just Joined!
    Join Date
    Nov 2011
    Posts
    1

    Question "Permission denied" running du as root?

    Hello all, thanks for reading a newbie post.

    TL;DR: I am trying to solve permission errors running df as root.

    System
    CentOS 4.9
    bash shell

    So, my /var directory is at 95%, and I want to know what's sucking up space. I only have ssh access, no gui. So I run this:

    Code:
    du -sh /var/*
    I don't much understand what it's doing, other than parsing du; I found the script after reading some forum posts.

    Unfortunately, I get a lot of permissions errors:

    Code:
    du: /var/agentx: Permission denied
    du: /var/amavis: Permission denied
    du: /var/at/tabs: Permission denied
    du: /var/at/tmp: Permission denied
      0B	/var/at
    du: /var/audit: Permission denied
    du: /var/backups: Permission denied
    du: /var/db/dhcpclient: Permission denied
    du: /var/db/dslocal/nodes/Default: Permission denied
    du: /var/db/krb5kdc: Permission denied
    du: /var/db/launchd.db/com.apple.launchd.peruser.0: Permission denied
    du: /var/db/launchd.db/com.apple.launchd.peruser.1: Permission denied
    du: /var/db/launchd.db/com.apple.launchd.peruser.212: Permission denied
    du: /var/db/launchd.db/com.apple.launchd.peruser.222: Permission denied
    du: /var/db/launchd.db/com.apple.launchd.peruser.26: Permission denied
    du: /var/db/launchd.db/com.apple.launchd.peruser.4294967294: Permission denied
    du: /var/db/launchd.db/com.apple.launchd.peruser.4294967295: Permission denied
    du: /var/db/launchd.db/com.apple.launchd.peruser.89: Permission denied
    du: /var/db/launchd.db/com.apple.launchd.peruser.92: Permission denied
    du: /var/db/launchd.db/com.apple.launchd.peruser.97: Permission denied
    du: /var/db/sudo: Permission denied
    649M	/var/db
      0B	/var/empty
    du: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.revisiond.temp: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n0000004000001/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n000003800000t/C: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n000003800000t/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n0000084000021/C: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n0000084000021/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000b400002s/C: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000b400002s/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000bh00002w/C: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000bh00002w/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000c4000031/C: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000c4000031/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000s800006_/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000sm00006d/C: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000sm00006d/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000th00006m/C: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000th00006m/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000tm00006n/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000vr00006y/C: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_n00000vr00006y/T: Permission denied
    du: /var/folders/zz/zyxvpxvq6csfxvn_ngzzzzzvzzzzzy/T: Permission denied
    219M	/var/folders
    du: /var/jabberd: Permission denied
    4.0K	/var/lib
    du: /var/log/krb5kdc: Permission denied
    du: /var/log/shutdown: Permission denied
     96M	/var/log
      0B	/var/mail
    4.0K	/var/msgs
      0B	/var/named
      0B	/var/netboot
     44K	/var/nmnetmgr
    du: /var/pgsql_socket: Permission denied
    du: /var/root: Permission denied
      0B	/var/rpc
    du: /var/run/.vfs_rsrc_streams_0xffffff800bae09300: Permission denied
    du: /var/run/mds: Permission denied
    120K	/var/run
      0B	/var/rwho
    du: /var/servermgrd/sessions: Permission denied
      0B	/var/servermgrd
    du: /var/spool/cups: Permission denied
    du: /var/spool/fax: Permission denied
    du: /var/spool/mqueue: Permission denied
    4.0K	/var/spool
    du: /var/tmp/launchd: Permission denied
      0B	/var/tmp
    du: /var/virusmails: Permission denied
    9.0G	/var/vm
      0B	/var/xgrid
      0B	/var/yp
    I am interested in the fix, but I also want to learn. Why does root get permission denied here? What precisely is the permission it needs - read? Execute?

    I'm a linux newb, but I am a programmer, so you can talk to me like an adult.

    Thanks in advance for your help!

    -- Kit
    Last edited by kit; 11-09-2011 at 12:32 PM.

  2. #2
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    I'd guess you're not really root.
    Code:
    whoami;echo $USER;id -ru

  3. #3
    Just Joined!
    Join Date
    Sep 2011
    Posts
    15
    post the output of these commands

    #ls -l /var/

    #cd /var
    #du -sh

    #who

  4. #4
    Linux User Krendoshazin's Avatar
    Join Date
    Feb 2005
    Location
    London, England
    Posts
    386
    As others have said, are you sure you're root? The root account should be able to read and modify anything, even if the permissions are set to 000. The only exceptions I know of are for FUSE filesystems which only allow the person who mounted the partition to access it. There are ways around that, though.

  5. #5
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,047
    It appears at first glance that your Vitrual Memory(?) directory is eating a lot of space:
    Code:
    9.0G	 /var/vm


    As for the permission denied errors, I'm not sure. I believe CentOS4.9 has SELinux, so that would be my first choice to look.

    If you log in as underprivileged user to become root, you do not automatically also become unconfined_u in the SELinux security context.

    Check with:
    Code:
    id -Z
    It should give output as this:
    Code:
    unconfined_u:unconfined_r:unconfined_t:s0
    Can't tell an OS by it's GUI

  6. #6
    Just Joined!
    Join Date
    Jan 2011
    Location
    Hyderabad, India
    Posts
    17
    verify that u r root user. If u r not the root then give the command

    su

    then execute the command

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...