chown and file ownership

S

superfly2

Hello,

I would like to create a file (using a perl script) that has a particular
owner and group (say "myowner" and "mygroup"). The script is owned by
"myowner:mygroup" but the file is currently owned by "base:base". The chown
command doesn't seem to work in my script (it returns 0 for the number of
files changed), even though I have added "base" to the myowner and mygroup
lines in my etc/group file.

Any help would be appreciated.

~Darius
 
B

Brian McCauley

superfly2 said:
I would like to create a file (using a perl script) that has a particular
owner and group (say "myowner" and "mygroup"). The script is owned by
"myowner:mygroup" but the file is currently owned by "base:base". The chown
command doesn't seem to work in my script (it returns 0 for the number of
files changed), even though I have added "base" to the myowner and mygroup
lines in my etc/group file.

On most Unix-like OSs only root can use the chown syscall can only be
used to change owner.

Note also the "base" is not a number. (perldoc -f chown)
Any help would be appreciated.

Check out the documentation for the Perl chown function and the
underlying chown syscall on your OS.

--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
 
J

Jürgen Exner

superfly2 said:
Hello,

I would like to create a file (using a perl script) that has a
particular owner and group (say "myowner" and "mygroup"). The script
is owned by "myowner:mygroup" but the file is currently owned by
"base:base".

A wild guess: is the directory configured in such a way that files created
inside of it have "base:base" (this would be a Unix question, not a Perl
issue)?
The chown command doesn't seem to work in my script (it
returns 0 for the number of files changed), even though I have added
"base" to the myowner and mygroup lines in my etc/group file.

On most OSs only root can use chown(), so you would have to run your script
as root which of course has other implications.

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,689
Members
48,796
Latest member
Greg L.

Latest Threads

Top