How to know which process is using the file - Aix

This is a discussion on How to know which process is using the file - Aix ; I am trying to find the process who is changing the time stamp of one of my files. I tried using the fuser but it is not working. # fuser /etc/passwd.nm.idx /etc/passwd.nm.idx: May i know how to use fuser. I ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: How to know which process is using the file

  1. How to know which process is using the file

    I am trying to find the process who is changing the time stamp of one
    of my files.
    I tried using the fuser but it is not working.

    # fuser /etc/passwd.nm.idx
    /etc/passwd.nm.idx:


    May i know how to use fuser.
    I tried "fuser -u " on a file which was kept open using vi editor
    on another terminal But it gave no result.

    Thank You


  2. Re: How to know which process is using the file


    saggar wrote:
    > I am trying to find the process who is changing the time stamp of one
    > of my files.
    > I tried using the fuser but it is not working.
    >
    > # fuser /etc/passwd.nm.idx
    > /etc/passwd.nm.idx:
    >
    >
    > May i know how to use fuser.
    > I tried "fuser -u " on a file which was kept open using vi editor
    > on another terminal But it gave no result.
    >
    > Thank You


    google for "aix" + "lsof"

    You can get a binary, or better yet, the source for your system.

    lsof - don't leave home without it


  3. Re: How to know which process is using the file

    aixdude@yahoo.com wrote:
    > saggar wrote:
    >> I am trying to find the process who is changing the time stamp of one
    >> of my files.
    >> I tried using the fuser but it is not working.

    > google for "aix" + "lsof"
    >
    > You can get a binary, or better yet, the source for your system.
    >
    > lsof - don't leave home without it


    Good solution - if the program has the handle open at the time you run lsof.

    If the writes are happening at unpredictable intervals (when you're not
    likely to run lsof), you should consider enabling auditing and adding an
    object in /etc/security/audit/objects e.g.:

    /etc/passwd.nm.idx:
    w = "S_NOTAUTH_WRITE"

    and then add all the users (everyone in the same group as the file) to
    monitor to /etc/security/audit/config:


    classes:
    abusers=S_NOTAUTH_WRITE"

    users:
    root = abusers
    user1 = abusers
    ....
    userN = abusers

    Then activate auditing in STREAM mode. For info, you can refer to the
    "Accounting and Auditing on AIX 5L" redbook.

    hope this helps.
    Niel

  4. Re: How to know which process is using the file

    >> May i know how to use fuser.
    >> I tried "fuser -u " on a file which was kept open using vi editor
    >> on another terminal But it gave no result.


    vi doesn't keep a file open that way.

    I was testing some stuff with fuser today and used a
    one line sleep program as fodder:

    # cat /tmp/sleep.c
    main(){
    sleep(1000);
    }
    # cc -o /tmp/sleep /tmp/sleep.c
    # /tmp/sleep&
    [1] 26748
    # fuser /tmp/sleep
    /tmp/sleep: 26748mt


    -Mike

+ Reply to Thread