LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 04-25-2018, 02:29 PM   #16
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,606
Blog Entries: 15

Rep: Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540

Quote:
Originally Posted by rknichols View Post
As has been suggested, it looks like you are in a chroot jail, and your home directory is also the effective filesystem root.
I'm not so sure of that any longer. He is running csh and his "pwd" is aliased to a variable called $cwd. He reported, when he ran the fully qualified path of command, pwd, (/bin/pwd) it returned "/". That suggests whatever the $cwd variable is set to is causing the odd response. That is why I asked him to run "printenv cwd" - for csh that should tell what the variable is set to.
 
Old 04-25-2018, 04:16 PM   #17
egyasssun
LQ Newbie
 
Registered: Apr 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MensaWater View Post
So it is aliased to a variable called cwd.

What does "printenv cwd" show?
Nothing.
But if I do "echo $cwd", this shows me the current path.
So, this variable is somewhere, but not in the environment. Right ? Where can it be ?

Last edited by egyasssun; 04-25-2018 at 04:20 PM.
 
Old 04-25-2018, 07:13 PM   #18
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Tribblix, Ubuntu/WSL
Posts: 9,760

Rep: Reputation: 459Reputation: 459Reputation: 459Reputation: 459Reputation: 459
csh is crappy and broken by design, and having a broken prompt command doesn't help, not sure if there is any interest in investigating the issue further.

Just switch to ksh, bash or whatever shell you are familiar with.
 
Old 04-26-2018, 08:11 AM   #19
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,606
Blog Entries: 15

Rep: Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540
Quote:
Originally Posted by egyasssun View Post
Nothing.
But if I do "echo $cwd", this shows me the current path.
So, this variable is somewhere, but not in the environment. Right ? Where can it be ?
So you're NOT in csh like you said earlier? In an earlier post it was suggested you run:
/usr/xpg4/bin/sh
That would have changed you from csh to sh (bourne shell). Are you still in that same session? I had suggested you log in to a session like you did originally.

When you say "current path" do you mean the one shown by /bin/pwd or the one previously shown by pwd without the /bin in front of it?
 
Old 04-27-2018, 12:58 PM   #20
egyasssun
LQ Newbie
 
Registered: Apr 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MensaWater View Post
So you're NOT in csh like you said earlier? In an earlier post it was suggested you run:
/usr/xpg4/bin/sh
That would have changed you from csh to sh (bourne shell). Are you still in that same session? I had suggested you log in to a session like you did originally.

When you say "current path" do you mean the one shown by /bin/pwd or the one previously shown by pwd without the /bin in front of it?
Yes, I am running csh.
I only used sh to test if the prompt would change, then I closed that session.

Repeating tests:
I reboot the machine and open a terminal.
The prompt says itīs at "myuser" directory.
The "pwd" command (without /bin in front) also shows "/home/staff/myuser".
The "echo $cwd" command also shows "/home/staff/myuser".

I do a "ls" command to see which files are in the current directory.
So I see Iīm in the root directory, not in "myuser".
When I say "current path" I mean the actual current path (shown by /bin/pwd): "/".
 
Old 04-27-2018, 01:11 PM   #21
egyasssun
LQ Newbie
 
Registered: Apr 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jlliagre View Post
csh is crappy and broken by design, and having a broken prompt command doesn't help, not sure if there is any interest in investigating the issue further.

Just switch to ksh, bash or whatever shell you are familiar with.
Ok, that seems a good advice, but I cannot switch (permanently) the shell being used.
My company has been working that way for years and they wouldnīt want to have it changed.

But at this point, it seems the main question still to be investigated is about the cwd variable, thatīs not listed in the environment, and I have no idea where it comes from.
 
Old 04-27-2018, 03:35 PM   #22
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,606
Blog Entries: 15

Rep: Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540
The value is coming from $cwd. Something in your environment is setting cwd to be the <weird path> you're seeing.

For csh look for "setenv cwd <value>" statements.
global setup for all csh users is defined in /etc/login.
local setup for csh users is defined in /$HOME/.csrhc and/or /$HOME/.login

For sh/ksh look for "cwd=<value>" statements.
global setup for all sh/ksh users is defined in /etc/profile.
local setup for sh/ksh users is defined in $HOME/.profile

NB: bash has additional files - this shell is most commonly used on Linux.

Any of the environment/setup files can "source" additional files and you'd have to examine those. Also they could invoke scripts that source additional files.

If you unalias pwd it should find the system pwd (/bin/pwd) instead of using $cwd.
 
Old 04-27-2018, 06:05 PM   #23
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,143

Rep: Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873
Quote:
Originally Posted by MensaWater View Post
The value is coming from $cwd. Something in your environment is setting cwd to be the <weird path> you're seeing.
No, see the section "Special shell variables" in the csh manpage. The shell internally sets and updates cwd. It is not, technically, part of the environment.
 
1 members found this post helpful.
Old 04-30-2018, 08:44 AM   #24
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,606
Blog Entries: 15

Rep: Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540Reputation: 1540
Quote:
Originally Posted by rknichols View Post
No, see the section "Special shell variables" in the csh manpage. The shell internally sets and updates cwd. It is not, technically, part of the environment.
I see that you are right. I also see that trying to change it from command line doesn't work (in csh on Linux - I don't have a Solaris system to test). After some searching I found a nice discussion about why cwd and /bin/pwd could report different things at http://www.grymoire.com/Unix/Csh.html.

That says in part:
Quote:
Specifying the current directory

There are two ways to find out what your current working directory is. The first is with the program "pwd" - print working directory. The second is with the variable "cwd," which can be examained by

echo $cwd

or by creating a new alias

alias cwd 'echo $cwd'

Examining the internal variable "cwd" is faster than executing the stand-alone program "pwd," but there is one subtle difference. If you access a symbolic link in your directory path, then "pwd" will show the actual directory path, while "cwd" will show the path you used to get to the directory.
The above however, suggests maybe it is a symbolic link he is going to on login. OP examining the home directory path seen for the user in /etc/passwd from root (/) down to check for symbolic links might be useful.

I also found some discussion of changing csh cwd via programming including some TCL stuff. It may be OP has is executing a binary in one of his environment files that is changing this.

Last edited by MensaWater; 04-30-2018 at 08:49 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is the user root home directory needed in linux LinuxPirate Linux - Newbie 9 11-07-2015 09:29 PM
User does int getting home directory in root home in ubuntu 10.04 lucid lynx sunrised24 Linux - Server 2 03-07-2012 09:21 AM
How to set root user under home directory ? mohgam Linux - Newbie 7 01-12-2012 08:10 AM
Can root and my main user account share the same home directory? rivercat Linux - Newbie 11 02-21-2011 07:22 PM
User Home Directory now owned bt Root AndeAnderson Linux - Newbie 4 10-09-2009 03:52 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 05:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration