file ownership confusion


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting file ownership confusion
# 1  
Old 12-01-2008
file ownership confusion

Hello all,
I have a script that runs on both the test and production box. The script is owned by a user (abcd for example) with permission set to 700. When this script is run as a root, the log file generated has owner and group as abcdowner and abcdgroup respectively.
Now, when I run the same script in production box as a root(with same script permission 700), I get the logfile with owner as a root and system as a group.
I need to have the ownership of the logfile exactly as the way it comes out in test box for my production box.

Here is my question? what is making the test box to produce the logfile with the mentioned owners whereas it is different for the production box.

Pls..do not say to change the ownership of the logfile from the script in the production box to make it like the test box because that will be the work around not a permanent solution.

thanks
# 2  
Old 12-01-2008
The script owner and group have no relationship with the log file ones. Files created by a user belong to that user. Existing files might belong to someone else.

I guess the script was probably run by abcd once. Further execution by root using the same log file didn't change the log owner.
# 3  
Old 12-01-2008
What are the permissions on the directory where the logfile is being written to?
# 4  
Old 12-02-2008
permission on log file directory:
for prod environment: 700
for test environment: 750

Again, test environment produces output of the log file with ownership as: abcdowner:abcdgroup. and this is what I want for the prod environment as well.
# 5  
Old 12-02-2008
Permissions shouldn't make any difference.

Double check you are really running as root on the test box and that the log file doesn't already exists.

Can you tell what OS and what filesystem you are using too ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

file execution confusion

i have a file in a directory ls -l gives -rwxr-xr-- so i typed the file name to execute it and i got no such file but when i type . ./filename i can execute it what does this . ./ do ?:confused: (15 Replies)
Discussion started by: mithun1!
15 Replies

2. Shell Programming and Scripting

File Ownership Change

Hi, I have several directories under an upload directory where differnt users upload their files (with exxactly the same file name every week) using their own user ids. There is a requirement that once any user uploads the file I have to clean that file and remove extra whitespaces and... (3 Replies)
Discussion started by: vbhonde11
3 Replies

3. Red Hat

Linux file ownership

Hi Friends, I am using RHEL5.3 64bit. I have a data filesystem on this, which have lot of files copied from another server. I cannot see correct owner and group displayed for these servers. It shows 113 for owner and 755 for group. Anybody please tell me why it is? Regards, Arumon (1 Reply)
Discussion started by: arumon
1 Replies

4. UNIX for Dummies Questions & Answers

What is the need of ownership to a file/dir?

Hi, I understand the permissions of a file/directory. I just needs to understand how ownership works. Can some one help me on this please? Thanks in advance. (6 Replies)
Discussion started by: praveen_b744
6 Replies

5. UNIX for Dummies Questions & Answers

Access file ownership related questions

I have two issues; any help regarding this would be highly appreciated. We deployed a file abc using pqr id. So the owner is of abc file (shell script) is ‘pqr'. However, abc file is executed by ESP event and uses the id ‘xyz'. When the file abc is executed the owner of... (9 Replies)
Discussion started by: clearC
9 Replies

6. UNIX for Advanced & Expert Users

File group ownership changing automatically

Hi everyone, Need help with an issue. The group ownership of files on my Solaris system is getting changed automatically. Could someone tell me the reason why? And how could I correct it? One more info- everytime the ownership changes, it changes to "x". Thanks :confused: (1 Reply)
Discussion started by: top_gun
1 Replies

7. UNIX for Dummies Questions & Answers

Stubborn file ownership problem! Argh!

Hi, I have Apache running well on a Linux server, with Samba installed. I do must of my work in Notepad2 on a Windows box using Samba shares on which I am logged in as a user on the box (non-root). I recently decided to expand into cgi-perl. My /htdocs/cgi-bin directory is already part of a... (0 Replies)
Discussion started by: questor
0 Replies

8. Shell Programming and Scripting

help regarding file ownership

hi friends,i have a doubt,if there is a file for which i have only read access then is there any way to execute it,plz reply soon (5 Replies)
Discussion started by: amit007
5 Replies

9. UNIX for Advanced & Expert Users

File system Confusion

Hello All, I administer my department server and now Im assigned the job of installing a new server. The old server has no home directory but the user accounts are managed using a script and they are partitioned in /fs/grad, /fs/ugrad, /fs/fac, /fs/alumni. But when I finger for a... (1 Reply)
Discussion started by: maybemedic
1 Replies

10. UNIX for Dummies Questions & Answers

Unix ownership from directories and file

Hi, I have newly installed sun solaris on my pc since I would like to learn something more about unix. During the installation, I had to assign a password for the super user root.After the installation, the book I am following suggested me to create a new user which I did. My home directory is... (1 Reply)
Discussion started by: giulianob
1 Replies
Login or Register to Ask a Question