* chmod on link?
@ 1998-12-09 5:00 ivan.dolezal
1998-12-09 5:00 ` Timo Felbinger
1998-12-09 5:00 ` Timo Felbinger
0 siblings, 2 replies; 7+ messages in thread
From: ivan.dolezal @ 1998-12-09 5:00 UTC (permalink / raw)
Hello,
I got a really dumb question: if I create a soft link, its permission is
lrwxrwxrwx .
How can I change it?
Thanks,
Ivan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: chmod on link?
1998-12-09 5:00 chmod on link? ivan.dolezal
@ 1998-12-09 5:00 ` Timo Felbinger
1998-12-09 5:00 ` Timo Felbinger
1 sibling, 0 replies; 7+ messages in thread
From: Timo Felbinger @ 1998-12-09 5:00 UTC (permalink / raw)
To: ivan.dolezal
On Wed, 9 Dec 1998 ivan.dolezal@vsb.cz wrote:
> I got a really dumb question: if I create a soft link, its permission is
> lrwxrwxrwx .
>
> How can I change it?
You can't. Links don't have any permissions, only files and other things
like devices and pipes which are represented by inodes, have.
An inode is a data structure containing vital data describing the file,
including permissions, owner, ...
When you use a link, the permissions of the file pointed to will apply.
While ls will display the permissions of the file associated with a hard
link, it will always show lrwxrwxrwx for soft links.
Simple experiment: If a file has more than one hard link, ls will display
identical permissions (as well as ownership, access time, ...) for all
of them.
--
Timo Felbinger (Timo.Felbinger@quantum.physik.uni-potsdam.de)
Quantum Physics Group
Institute of Physics
University of Potsdam, Germany
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: chmod on link?
1998-12-09 5:00 chmod on link? ivan.dolezal
1998-12-09 5:00 ` Timo Felbinger
@ 1998-12-09 5:00 ` Timo Felbinger
1998-12-09 5:00 ` Nikola Milutinovic
1 sibling, 1 reply; 7+ messages in thread
From: Timo Felbinger @ 1998-12-09 5:00 UTC (permalink / raw)
To: ivan.dolezal
On Wed, 9 Dec 1998 ivan.dolezal@vsb.cz wrote:
> Thanks for your asset, but I can see in my Digital Unix's root
>
> lrwxr-xr-x 1 root system 7 Oct 4 16:09 var -> usr/var
>
> Both of them are directories (so it can't be a hard link).
What do you mean by "both"? On my system, /var is a soft link to
/usr/var, while /usr/var is (a hard link of) a directory.
> And, it would also mean that I can't deny anybody to erase the link that
> I made and substitute it with his/her link but just make the whole
> directory containing the link rewritable by the person responsible
> enough to not damage the link. It could be very dangerous indeed!
Someone who has write access to a directory can always remove entries
in this directory, regardless of type, ownership and permissons.
You don't want to have / writable for anyone but root, do you?
As a minor correction of my previous post, soft links are technically
files containing a path, so they have an inode of their own. However,
the permissions in this inode are not used, and DU won't create more
than one hard link to a soft link: after
touch a
ln -s a b
ln b c
c will be another hard link for a.
BTW, this is different e. g. on a Linux system: there, c will become a
second hard link for the soft link b!
Regards,
Timo
--
Timo Felbinger (Timo.Felbinger@quantum.physik.uni-potsdam.de)
Quantum Physics Group
Institute of Physics
University of Potsdam, Germany
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: chmod on link?
1998-12-09 5:00 ` Timo Felbinger
@ 1998-12-09 5:00 ` Nikola Milutinovic
1998-12-09 5:00 ` Casper H.S. Dik - Network Security Engineer
0 siblings, 1 reply; 7+ messages in thread
From: Nikola Milutinovic @ 1998-12-09 5:00 UTC (permalink / raw)
Timo Felbinger wrote:
>
> On Wed, 9 Dec 1998 ivan.dolezal@vsb.cz wrote:
>
> > Thanks for your asset, but I can see in my Digital Unix's root
> >
> > lrwxr-xr-x 1 root system 7 Oct 4 16:09 var -> usr/var
> >
> > Both of them are directories (so it can't be a hard link).
The question still stands. A soft link is a file. A file can be written
to and I think I've seen some system calls that can manipulate either "a
link to" and "a link itself". If you can't access the link itself, why
would DEC put such access rights on one of the most common system soft
links?
Nix.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: chmod on link?
1998-12-09 5:00 ` Nikola Milutinovic
@ 1998-12-09 5:00 ` Casper H.S. Dik - Network Security Engineer
1998-12-09 5:00 ` Serguei Patchkovskii
0 siblings, 1 reply; 7+ messages in thread
From: Casper H.S. Dik - Network Security Engineer @ 1998-12-09 5:00 UTC (permalink / raw)
[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]
Nikola Milutinovic <Nikola.Milutinovic@ev.co.yu> writes:
>The question still stands. A soft link is a file. A file can be written
>to and I think I've seen some system calls that can manipulate either "a
>link to" and "a link itself". If you can't access the link itself, why
>would DEC put such access rights on one of the most common system soft
>links?
A soft/sym link is not a file.
It can be manipulated in only two ways:
- unlink(2) - remove it
- symlink(2) - create it
obviously, for both operations the permissions on the file are irrelevant
(the directory counts)
You could interpret permissions on the link, but typically (no
Unix implementation I know of) does so.
The links are displayed differently:
lrwxrwxrwx SunOS 4/Solaris 2&7
l--------- Irix (others?)
Some may just use the user's umask() in creating them, (DU)?
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: chmod on link?
1998-12-09 5:00 ` Casper H.S. Dik - Network Security Engineer
@ 1998-12-09 5:00 ` Serguei Patchkovskii
1998-12-11 5:00 ` Mike harrelson
0 siblings, 1 reply; 7+ messages in thread
From: Serguei Patchkovskii @ 1998-12-09 5:00 UTC (permalink / raw)
Casper H.S. Dik - Network Security Engineer (Casper.Dik@Holland.Sun.Com) wrote:
: A soft/sym link is not a file.
: It can be manipulated in only two ways:
: - unlink(2) - remove it
: - symlink(2) - create it
Well, strictly speaking this aint true on all unices (it may be true for
Sunos and/or Solaris - I just don't know). On most unices it is also
possible to lstat() a symbolic link, and on some it is possible to
lchown() and readlink() it. Unless I am mistaken, later versions of
Irix also have lchmod() (which, like lchown(), has no real meaning,
but was added due to the popular demand).
(readlink(), lstat(), and lchown() are actually required by XPG4 UNIX,
so that I am sure they are also supported by Solaris, if not by SunOS).
: lrwxrwxrwx SunOS 4/Solaris 2&7
: l--------- Irix (others?)
: Some may just use the user's umask() in creating them, (DU)?
DU creates symlinks with 0777 regardless of the users' umask. Irix
(ay least 5.* and 6.[0-4]) does indeed uses users' umask.
Regards,
/Serge.P
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: chmod on link?
1998-12-09 5:00 ` Serguei Patchkovskii
@ 1998-12-11 5:00 ` Mike harrelson
0 siblings, 0 replies; 7+ messages in thread
From: Mike harrelson @ 1998-12-11 5:00 UTC (permalink / raw)
In article <74mhkm$7le@ds2.acs.ucalgary.ca>,
Serguei Patchkovskii <patchkov@acs1.acs.ucalgary.ca> wrote:
>Casper H.S. Dik - Network Security Engineer (Casper.Dik@Holland.Sun.Com) wrote:
>
>: A soft/sym link is not a file.
>
>: It can be manipulated in only two ways:
>
>: - unlink(2) - remove it
>: - symlink(2) - create it
>
>Well, strictly speaking this aint true on all unices (it may be true for
>Sunos and/or Solaris - I just don't know).
I think he meant it isn't a regular file.
>On most unices it is also possible to lstat() a symbolic link, and on some it is
>possible to lchown() and readlink() it.
lstat(), readlink() are required to get information on a symlink and are fairly
standard. lchown() exists on Unices where chown() follows a symlink.
>Unless I am mistaken, later versions of Irix also have lchmod() (which, like lchown(),
>has no real meaning, but was added due to the popular demand).
lchown() does have real meaning. Ownership of a symlink is needed, particularly in
directories like /tmp with sticky bits set.
-- mikeh
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1998-12-11 5:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-12-09 5:00 chmod on link? ivan.dolezal
1998-12-09 5:00 ` Timo Felbinger
1998-12-09 5:00 ` Timo Felbinger
1998-12-09 5:00 ` Nikola Milutinovic
1998-12-09 5:00 ` Casper H.S. Dik - Network Security Engineer
1998-12-09 5:00 ` Serguei Patchkovskii
1998-12-11 5:00 ` Mike harrelson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox