RE: Query regarding the owner and group of a file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

> Hi,
> I have an C++ application(logger.exe) running on my linux 
> machine. This application logs all the information to a log 
> file named trace.log. The owner and the group of the files 
> are as follows.
> 
> File name                         owner         group   user
> =========                         =====         =====   ====
> C++ application (logger.exe)      root          root    root
> trace.log                         root          root    root
> 
> The C++ application(logger.exe) and trace.log are having root 
> as owner and root as group.
> When I open this trace.log with vi editor(redhat linux kernel 
> 2.6) and save during when the application is running and edit 
> it, the application stops logging to the file no more logs 
> are logged into the trace.log file even the application is 
> running. Why this behaviour?
> 
> But I created another user named test and changed the owner 
> and group as follows.
> 
> File name                         owner         group  user
> =========                         ====          =====  ====
> C++ application (logger.exe)      test          test   test
> trace.log                         test          users  test
> 
> Then log file continues to log even after editing the log 
> file with vi editor.
> 
> NOTE:But I want my application to run when the owner, group 
> and user for
> both the files as root.      
> 
> Can somebody give pointers on this. Your comments will be appriciated.
> 
> Regds,
> Ravi

If you edit a file via vi and then save the changes, you will get a whole
new file with a new i-node number.  Your program will no longer be writing
to that file.  I believe this is expected behavior.

Are you sure that, with the owner being 'test', you are actually editing and
saving changes to the file?  I tested this myself with a non-root user and
the program (in my case a simple script) no longer writes to the file (it
exhibits the same behavior as with root).

If you do:

ls -i trace.log

before and after you edit and save changes, do you get the same number?


Michael

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux