General
cancel
Showing results for 
Search instead for 
Did you mean: 

file ownership change after running script

BlueNet
Occasional Visitor

file ownership change after running script

hi,
i wrote shell script owned and run by root ..
this shell script contains commands to be run by root (commands require root privs) and commands to be run by user1 (as user1 is owner and these commands must run by him)..
inside the script i use "su - user1" to run user1 commands.
it works fine, but i found some files that owned by user1 has changed to be owned by root. it took me while to fix these files and search for all changes since these commands involve many files and directories..
why this happen? and can i avoid it next time i run this script?

thank you
1 REPLY
Steven Schweda
Honored Contributor

Re: file ownership change after running script

> why this happen?

How should I know? How could anyone else
know?

What's in your "shell script"? Who owns what
in your file system(s)? Which "some files",
created where, how? My psychic powers are
too weak to show me what you're doing, or
what happens when you do it.

As usual, showing actual commands with their
actual output can be more helpful than vague
descriptions or interpretations.