lkml.org 
[lkml]   [2000]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: permissions not honoured by /bin/pwd aka getcwd
-----BEGIN PGP SIGNED MESSAGE-----


On 24-Feb-2000 Richard B. Johnson wrote:
> On Thu, 24 Feb 2000, Harald Kirsch wrote:
>
>> On Thu, Feb 24, 2000 at 08:18:17AM -0500, Richard B. Johnson wrote:
>> > On Thu, 24 Feb 2000, Harald Kirsch wrote:
>> > > Why is /bin/pwd (or getcwd) allowed to return an output in the following
>> > > command sequence?
>> > >
>> > >
>> > > % mkdir -p really/closed; cd really/closed; chmod 000 ..; /bin/pwd
>> > > /home1_phys/kir/sunHome/tmp/really/closed
>> > >
>> > > Harald Kirsch
>> >
>> > Because permissions don't prevent you from reading a directory.
>>
>> Strange answer. What is `chmod a-r some/directory' good for if not to
>> forbid reading a directory?
>>
>> Harald Kirsch
>
> If prevents non-root from reading (i.e. entering) the directory. You
> are never going to hide the directory contents from root.
>
> Here is a non-root user:
>
> Script started on Thu Feb 24 09:07:10 2000
> $ pwd
> /tmp
> $ mkdir foo
> $ mkdir foo/bat
> $ ls
> foo typescript
> $ ls foo/*
> $ cd foo
> $ ls
> bat
> $ cd ..
> $ ls
> foo typescript
> $ chmod 0 foo
> $ ls
> foo typescript
> $ cd foo
> bash: foo: Permission denied
> $ ls foo/*
> ls: foo/*: Permission denied
> $ exit
> exit
>
> Script done on Thu Feb 24 09:08:37 2000

Richard, I think the question is different. It is not root vs user.

It is the behaviour of linux pwd. It does not go over the directory tree like
solaris pwd and others. It reads '.' and prints it. F.e. sol reads and tries to
resolve symlinks. And bummers.

Try the following:

mkdir -p /tmp/crap/crap1 ; ln -s /tmp/crap /tmp/crap2 ; cd /tmp/crap2/crap1 ;
pwd

on linux it returns /tmp/crap2/crap1
on solaris it returns /tmp/crap/crap1

If permissions on crap are 000 solaris bummersm, linux does not. This is on
debian-potato and sol 2.6 respectively.

And this is gnu fileutils not linux as such.

In btw1: at least in some slackware (2.?) long ago pwd was working properly if
sol's behaviour is considered proper.

P.S. Harald, excuse me for the hasty answer off the list. I did not think
properly first.

Cheers ;-)

- ----------------------------------
Anton R. Ivanov
IP Engineer Level3 Communications
RIPE: ARI2-RIPE E-Mail: Anton Ivanov <aivanov@eu.level3.net>
@*** Maier's Law ***
If the facts do not conform to the theory, they must be disposed of.

- ----------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.0 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iQEVAwUBOLVF1SlWAw/bM84zAQFLHgf+Lt5qeEMa83rrRicayIWNbWWBaplvBOMs
Mx1ybZ5jDCpV1qawCpUGKztFu4Ho/HoI6GJ3cNJaxOUKvAeOTPDdtLMUcxX0T1+o
lxIqiw82n5oc3UmArti5iS92AtefznpA0ESci+8LrxF92cIGp7sXREx0yIV/mroK
qFE3FU9psQl7YPXWMoMw+6JceYgxBy8vb6eDJpsDUNRWwAVfUkNOAvA8J6w/DKrH
1ENBtY+Fs3lmMY0AcxOxjZmZSSgrr6tSes4inSAft6tjaDeNK2CVeBoEEC0vxFGs
7hg28AOUvdeCdXGp5Y40X8uOz4NquoM4CxoSVW8PiJDvniCIuD4Wxg==
=0AUX
-----END PGP SIGNATURE-----

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.088 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site