Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

How do I change the owner:group of a symlink?

by v_thunder (Scribe)
on May 24, 2002 at 03:38 UTC ( [id://168970]=perlquestion: print w/replies, xml ) Need Help??

v_thunder has asked for the wisdom of the Perl Monks concerning the following question:

I am testing this on HP-UX 11.00 on PA-RISC.

The perl chown command is following links when the last argument is a symbolic link and not a normal file. I'd like to change the ownership of the link itself.

Just for completeness: GNU chown sets the owner:group of the link itself. HP-UX's chown behaves as perl does.

SoPWified - dvergin 2002-05-24

  • Comment on How do I change the owner:group of a symlink?

Replies are listed 'Best First'.
Re: How do I change the owner:group of a symlink?
by Marza (Vicar) on May 24, 2002 at 19:58 UTC

    Actually you can't in Perl.

    As Tom Christiansen has said(I don't remember where):

    "Perl doesn't do this. Do you know why many systems don't support the idea? Because it conveys no distict functionality. Modes and owners and times on symbolic links have no meaning. So why bother? And it's very non-portable."

    Now as to making a system call. Did you use the "-h" option? I did and it did change the link's ownership without changing the file.

      Oh, bummer. I know it doesn't really matter, but I just need this group of to be owned by bin:bin. Just, uh, because :)

      And you are absolutely right about the -h option. I don't know how I missed it, it's the first option on HP-UX's chown(1) manpage!

      Thanks a bunch,
      -Dan

Re: How do I change the owner:group of a symlink?
by Anonymous Monk on Jun 13, 2017 at 14:16 UTC
    use Lchown; lchown $uid, $gid, @linknames or die "Can't 'lchown($uid, $gid, @linknames)': $!";

    See Lchown for details.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://168970]
Approved by mdillon
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found