0

There is something I am not understanding. I have used the method found here about changing user default directory using vipw /etc/passwd

However once I go into this file and change a user default dir setting their bash prompt changes to, from my machine from ex. "[root@directory ~]#" to "bash-4.1$"

Now if I try to change the global bash prompt $PS1 the user with change dir having bash-4.1$ cannot see the custom prompt.

What is this behavior?

Guy St-Louis
  • 59
  • 2
  • 8
  • I believe you are mistaken about what the directory named in /etc/passwd actually is. It's the user's home directory; it's not a "default directory", except by convention and extension because it's a directory that is *supposedly* writable by the user, and relatively private. (Remember Linux is a multi-user system by design.) If the named home directory doesn't exist, or if it does exist but the permissions don't grant the user read/write/execute permissions, all sorts of things will break. I have a strong feeling you are seeing one of those things breaking. – user Oct 17 '15 at 22:05
  • @MichaelKjörling Thanks for the reply. Actually you're right, when I changed the directory, whatever I changed it to I realized that there were permission problems. So this means only because there was a permission problem, or whatever else it could be, this is why I'm seeing this weird bash-4.1? obviously I won't be lazy and test this but since I'm typing away here... – Guy St-Louis Oct 17 '15 at 22:15
  • @GuySt-Louis It is indeed a permission problem. The prompt changes because bash can not find a readable `.bash_profile` or the like (which is normally located in your home directory as dictated by `/etc/passwd` from which it can read your prompt settings, so it reverts to defaults. – Jarmund Oct 17 '15 at 23:18

1 Answers1

1

You changed your home directory, but you probably left the files in the old directory.

When bash is invoked it reads and executes some files, some of them in your home directory (for example ~/.profile).

Since you changed your home directory it doesn't find them. So any configurations you find in those files (like your prompt) won't get applied to your bash.

  • ill take a look at this too – Guy St-Louis Oct 17 '15 at 22:16
  • do you know all the files that need to be transferred over to resolve this issue? – Guy St-Louis Oct 18 '15 at 21:38
  • Sorry, I am not a bash user and I use another OS. Your bash manpage should have a list of files it uses (probably near the end of the manpage). Also like inside those files - maybe those files call other files. –  Oct 18 '15 at 21:44