Original Question:
How do you change the permissions for a symbolic link?
The reason for this question was that we have several links
with lrwxr-xr-x permissions and I was asked how they got
that way. (See response from Dr. Thomas P. Blinn below)
Here is a summary of the responses:
> You don't
> chmod -h user:group filename
(The chmod command on Digital UNIX doesn't have a -h parameter)
> If you're really, really determined then you delete the link, set
> your umask appropriately, and recreate the link.
(I was not able to do this by setting umask)
> You can't. In any case the permissions that apply are those of the file
> that is linked to.
> why would you? the true permissions are the ones on the file, not on the
> link.
> You don't. It's the permissions of the final referenced file that are
> used, not the soft link's.
> You don't. Symbolic links are supposed to always be protected 777 (as you
> see them), all that really matters is the protection of the think at the end
> of the link in terms of access restrictions.
>
> If you look at the chmod(2) reference page (the one for the function, not
> for the command) you'll see this in the description of parameters:
>
> path Specifies the full pathname of the file. If the path parameter
> refers to a symbolic link, the chmod() function changes access
> permissions on the file specified by the symbolic link.
>
> There's also a comment to the effect that some things can be set with
> mknod() that can't be set with chmod(); but I don't think mknod() can be
> used to create a symbolic link, and symlink() doesn't have a way to set
> the mode of the created link.
>
> I have seen situations where symbolic links wind up with a protection other
> than 777, but I think it occurred while tar or some program like it was
> doing a restoration in a context where a umask was in effect. Very weird.
>
> Tom
>
> Dr. Thomas P. Blinn, UNIX Software Group, Digital Equipment Corporation
> 110 Spit Brook Road, MS ZKO3-2/U20 Nashua, New Hampshire 03062-2698
> Technology Partnership Engineering Phone: (603) 884-0646
> Internet: tpb_at_zk3.dec.com Digital's Easynet: alpha::tpb
> ACM Member: tpblinn_at_acm.org PC_at_Home: tom_at_felines.mv.net
>
> Worry kills more people than work because more people worry than work.
>
> Keep your stick on the ice. -- Steve Smith ("Red Green")
>
> My favorite palindrome is: Satan, oscillate my metallic sonatas.
> -- Phil Agre, pagre_at_ucsd.edu
>
> Opinions expressed herein are my own, and do not necessarily represent
> those of my employer or anyone else, living or dead, real or imagined.
Thanks to:
Robert L. McMillin (rlm _at_ syseca-us.com)
Ross (rwa _at_ cs.athabascau.ca)
Roger (C-Picard _at_ mail.dec.com)
Dr. Thomas P. Blinn (tpb _at_ zk3.dec.com)
Alex_Nord _at_ Jabil.com
Richard Eisenman (eisenman _at_ tricity.wsu.edu)
beckers _at_ josephus.furph.com
Bill Smargiassi (bill _at_ lists.smed.com)
bprigge _at_ dttus.com
stevev _at_ hexadecimal.uoregon.edu
Simon Tardell (Simon.Tardell _at_ physto.se)
Volker Hejny (Volker.Hejny_at_exp2.physik.uni-giessen.de)
Wesley Darlington (w.darlington _at_ am.qub.ac.uk)
Petri Kallberg (kallu _at_ islay.fno.dec.com)
Lars Bro (lbro_at_dscc.dk)
Thanks again!
Dave Chapman
david.w.chapman_at_ussev.mail.abb.com
Received on Mon Oct 27 1997 - 17:52:31 NZDT