Strange behaviour of the "cd" command

blind Pete 0123peter at gmail.com
Tue Jul 11 12:30:11 UTC 2017


Dr Rainer Woitok wrote:

> Greetings,
> 
> On a rather fresh installation of Kubuntu 16.04 I ran into the following
> problem:
> 
> General information:
> 
> $ uname -a
> Linux tux 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017
> x86_64 x86_64 x86_64 GNU/Linux $ echo $SHELL
> /usr/bin/ksh
> $ unset CDPATH
> $ ls -la / | head -4
> total 116
> drwxr-xr-x  24 root root  4096 2017-06-26 19:05 .
> drwxr-xr-x  24 root root  4096 2017-06-26 19:05 ..
> drwx------   2 root root  4096 2016-05-25 11:19 .cache
> $ cd /.cache
> /usr/bin/ksh: hist[7]: cd: /.cache: [Permission denied]
> 
> The above message is exactly what one would expect, and thus ok.
> 
> $ cd
> $ pwd
> /home/rainer
> $ ls -la ../../ | head -4
> total 116
> drwxr-xr-x  24 root root  4096 2017-06-26 19:05 .
> drwxr-xr-x  24 root root  4096 2017-06-26 19:05 ..
> drwx------   2 root root  4096 2016-05-25 11:19 .cache

   ^^^^^^^^^

Root has read, write and execute permission for that 
directory, nobody else may cd into it.  


> $ cd ../../.cache
> /usr/bin/ksh: hist[11]: cd: /cache: [No such file or directory]
> $ pwd
> /home/rainer

No such directory is available to ordinary users 
like "rainer".  

If you are good friends with the system administrator try; 

sudo ls -al /.cache
or 
sudo chown rainer:rainer /.cache
or 
sudo chmod 755 /.cache

> However, the error message above  is definitely not what I had expected!
> In the error message mind in particular the missing dot in "/cache".
> 
> What's happening here?

The error message could be better.  If it worries you take it up with 
the shell maintainers.  

> Sincerely,
>   Rainer

-- 
blind Pete
Sig goes here...  





More information about the ubuntu-users mailing list