SunOS confusing root directory and user home directory
SunOS confusing root directory and user home directory
(OP)
Hello,
I´ve just started using a Solaris machine with SunOS 5.10.
After the machine is turned on, I open a Console window and at the prompt, if I execute a pwd command, it tells me I´m at my home directory (someone configured "myuser" as default user after init).
MACH1!myuser(staff,----,noView)@../myuser [41] pwd
/home/staff/myuser
But the weird thing is that if I run a ls command, it shows me that in fact, it´s at the root directory (!!!)
MACH1!myuser(staff,----,noView)@../myuser [42] ls -l
(Shows directories:
/etc
/home
/usr ...)
And if I go to a subdirectory, something stranger happens.
It assumes a false path.
MACH1!myuser(staff,----,noView)@../myuser [43] cd etc
MACH1!myuser(staff,----,noView)@../etc [44] pwd
/home/staff/myuser/etc
If I try to call this false path, the shell naturally can´t do it.
MACH1!myuser(staff,----,noView)@../etc [45] cd /home/staff/myuser/etc
/home/staff/myuser/etc: No such file or directory
But if I call my home path, it works as expected.
MACH1!myuser(staff,----,noView)@../etc [46] cd /home/staff/myuser
/home/staff/myuser
MACH1!myuser(staff,----,noView)@../myuser [47] ls -l
(shows files in my home directory)
Well, I´m not so experienced with Unix and I have no idea what can be wrong. I looked some files such as .profile, dtautologin, but couldn´t find anything that seemed to be causing this problem.
Can anyone give me a idea of what´s wrong with the configuration of this machine ?
RE: SunOS confusing root directory and user home directory
First thing that comes to mind is that your home directory may either not exist (which will throw you to the root dir "/"), or it may have been accidentally created as a link (hard or soft) to the root directory. That would explain why 'pwd' thinks you are in your home directory, but the 'ls' shows the root directory.
Show us your /etc/passwd entry so we can confirm it's formatted correctly. Don't worry, it does not (should not) include your password hash. 'grep -i myuser /etc/passwd'.
Second, let's see what the directory is...
CODE
Also, what shell are you in? Also, let's get a little more info. Please do the following and give us the results (please scrub it of any proprietary or confidential information).
CODE
Other ideas, maybe you are in a badly set up zone. Maybe your disk is corrupted. Maybe you are being tested by devious coworkers.
RE: SunOS confusing root directory and user home directory
Excuse me for this long time without answering.
I discovered that my problem was due to a highly customized prompt with csh shell.
CODE --> csh
That explains ... but if you still want some additional info, just tell me.
Thanks for your attention !
RE: SunOS confusing root directory and user home directory
Also, that's the problem with having something like '$cwd' in your PATH. It may not correspond to the actual current working directory. Try changing it to $PWD. The environment variable PWD is set by the 'cd' command, so it should be more accurate.
RE: SunOS confusing root directory and user home directory
In fact, $cwd and $PWD are returning the same result.
Both return the same false path - for example, "/home/staff/myuser/etc".
But there´s another thing I forgot to mention.
If I run "pwd", this yields: "/home/staff/myuser/etc" (false).
But if I run "/bin/pwd", this yields: "/etc" (correct).
This starts to happen since I open a console window and only stops when I leave the "/home/staff/myuser" structure.
So, I´m also dealing with different versions of pwd.
In the "/bin" directory, there´s a version that works the usual way.
But the default version is having a strange behavior - probably due to some configuration.