[NTLUG:Discuss] Is there a way to change permissions of a link

Kyle_Davenport@compusa.com Kyle_Davenport at compusa.com
Wed Nov 1 09:20:06 CST 2000


EMI: links in unix are not like the silly shortcuts in windows.  A soft link is
simply a pointer in its directory's inode table to the target inode.  A hard
link is actually the same file and inode by another name.  Many file commands
like cp, mv, tar, find... have arguments that change how they treat links
(whether they dereference them or not)






Steve Baker <sjbaker1 at airmail.net> on 10/31/2000 07:09:11 PM

Please respond to discuss at ntlug.org

To:   discuss at ntlug.org
cc:    (bcc: Kyle Davenport/Is/Corporate/CompUSA)
Subject:  Re: [NTLUG:Discuss] Is there a way to change permissions of a link



Neil Aggarwal wrote:
>
> Hello:
>
> I have several symbolic links set-up for a user of mine.
> They point to some files in the same directory.
>
> I want him to be able to copy new files into the targets
> of the links, but I dont want him to over-write the links
> themselves.
>
> Unfortunately, the links are mode 777.
>
> How do I change the mode of the links without affecting the
> targets?

OK - you have a couple of misconceptions:

* The mode of the links is irrelevent - Linux doesn't use them.
  The mode is always that of the destination file.

* When you copy (using 'cp' for example) a file to either the
  symlink *or* the think it links to, the change will go to the
  file itself and the symlink will still point to it.

* However, if you DELETE a symbolic link, it'll only delete the
  link.

Hence: BEWARE - some programs that "overwrite" files don't
literally do that, they delete the file and then create a
new one of the same name.  If one of those kinds of programs
is told to "overwrite" the SymLink, then it'll "break" the
link and you'll end up with two completely separate files.

Fortunately, not many programs make that mistake.









More information about the Discuss mailing list