×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

SunOS confusing root directory and user home directory

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

Weird. I've never seen this, but I have a few suggestions.

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

cd /home
ls -l
cd staff
ls -l 

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

echo ~
echo $HOME
cd ~
ls -l ~
cat ~/.profile
cat /etc/profile
cat ~/.kshrc  # Only is you're in a Korn shell
env
set
uname -a
id -a 

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

(OP)
Hi Sam,

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

set prompt="`uname -n | cut -f1 -d"." `\\!`whoami`($GROUP,$NCID,$VIEW)@../$cwd:t[\!] " 

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

Thanks for posting your solution. That helps others that may come by later with the same problem.

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

(OP)
Sam,

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close