root cannot cd out of already deleted directory using relative paths
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
root cannot cd out of already deleted directory using relative paths
Hi guys!
I'm having a really annoying problem which I can't find a cause for. My root user is unable to cd out of a already deleted directory using relative path definitions. For example, the following does work with my normal user, but not with root:
Code:
mkdir /tmp/test1
cd /tmp/test1
rmdir /tmp/test1
cd ..
Everything works fine for my normal user, but as root cd fails with
Code:
-sh: cd: ..: No such file or directory
This does work on a clean Slackware after install. I somehow manage to make it not work after some time and am now searching for the actual cause.
My first inclination was that it was due to the fact that root doesn't have the current working directory in it's PATH variable (for security reasons) but then you said it works in a clean install (which I can confirm) so obviously it is not a problem with the Slackware configuration itself. Have you done any shell modification that you are aware of, or are you using a different version of Bash?
I usually do not change my shell-settings. I do also have the standard bash of Slack-12.1 installed. However, I just tried something for good luck and probably found something.
It is a problem with sh, as it does work fine in bash. And using sh, it does also not work with the normal user. So, is it possible that sh is not capable of doing it?
If that would be the case, the only thing I would have to look for is why my root-user is using /bin/sh as default shell in konsole all of a sudden...
same think here with 12.1 and sh
it doesn't happen in bash
you (or someone?) probably did it in /etc/passwd
mine looks like this:
Code:
root:x:0:0::/root:/bin/bash
you probably have /bin/sh instead of /bin/bash
use vipw to fix it
if you have no need to use /bin/sh as the shell for root the it's best to stick with the defaults
if this happens every time, but you don't do it yourself then it's probably some software you're installing. or maybe got lost somewhere in KDE's graphical configuration utility.
Yeah, I thought so too, but it's /bin/bash there. When I do a login on tty6 everything does work fine, it's bash there too. Also rxvt does start with bash. It seems just konsole is messing it up. So I compared the config files of my two users, and they are the same except for the font-settings (this can't be possible, can it?). Now, on to further investigation.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.