Profile directory path changed

Asked by enawn00

Shutdown my computer, yesterday and yesterday evening I logged back on. The profile path changed. Now when I log on as myself, I actually log on to the root file. All my settings are still under /home/usrname. How do I get my log in to log me on to the correct path? :o)

Thanks for your timely response.

enawn00

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Larry Jordan
Solved:
Last query:
Last reply:
Revision history for this message
enawn00 (enawn00) said :
#1

Ubuntu 9.04
I have tried changing the path in Users and Groups.
I am not sure of how to change the path in the Bash command prompt.

Revision history for this message
Ufuk (ufukkilicaslan) said :
#2

If there is a file named .bash_profile in your /home/user directory, add this line to file:

HOME=/home/user

You should change user to your username. Then save the file, logout/login. If there is no file called .bash_profile in your user directory, create it and add the same line.

Revision history for this message
enawn00 (enawn00) said :
#3

I have three files in my /userile directory. They are : .bash _history, .bash _logout, .bashrc. I also have a file called .profile. The contents of this file is as follows.mask is set in

#~/.profile: executed by the command interpreter. for loging shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.t
# see /user/share/doc/bash/exaples/startup-files for examples.
# the files are located in the bash-doc package.

# The default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umaks package.
#umask 022

#if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
   fi
fi

# set PAYH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
       PATH="$HOME/ bin:$PATH"

fi

Will .profile work?

Revision history for this message
Ufuk (ufukkilicaslan) said :
#4

Try my suggestion and create a .bash_profile. If it does not fix it, you can delete it.

Revision history for this message
enawn00 (enawn00) said :
#5

Added the file. Have not been able to make the other change. Opened file back up to verify that it was there and path was indicated.

Revision history for this message
enawn00 (enawn00) said :
#6

Stuff I haven't tried yet. It is a work around sort of. I don't know if it would keep all my settings though. I could go in and set up another profile and delete this one and then re-add it. Then I could replace the file with a copy of the original. Just thought it would be better to fix it correctly. I am not sure doing it this way would keep it from doing it again?

Revision history for this message
Larry Jordan (larryjor) said :
#7

     This is educational for me. Seems Ubuntu/debian altered configuration to set up a default path elsewhere, which can then be overridden or added to by us users.As noted in ".profile", you can apparently override it (fairly) completely with the ".bash_profile" suggestion. I imagine your PATH variable (assume that is what you are asking about; output seen with "echo $PATH") should still include the basic stuff:

 /home/$USER/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

(Of course, $USER should have your username.)
     From there, you should be able to add to your PATH much the same way as in the example in your ".profile":

      PATH="$HOME/bin:$PATH"
      So, for example, if you had something in your $HOME directory you need to be able to call & execute, say in a directory like $HOME/scripts, you could add it by adding a line like this:
       PATH=$PATH:$HOME/scripts

       Just noticed something... guessing you typed in the contents of your ".profile" file, but in the real one, there's no space, right? Cause what you gave us says 'PATH="$HOME/ bin:$PATH"'. There shouldn't be a space before "bin".

      Anyway, is this on track with what you are asking about? Think it would be easier than trying to copy from a different profile or not, and might be a lot of unnecessary work.

Revision history for this message
enawn00 (enawn00) said :
#8

Sorry it took so long. Yes I did type it. I have been trying to correct this problem during my free time. And yes I typed it and I believe you are correct. So there should not be a space there. I am typing on a laptop and I tend to fat finger the keyboard. :o) Sorry again. Yeah, I have installed 8.04, 8.10, 9.04 and 7.? 9.04 is the most unstable version I have dealt with. I am not sure why, but it has been problematic for me.
OK, so every time I log in, with my username, it does not take me to the profile that I set up for myself. It takes me to root. It used to take me to my profile and then one night I shut down and then started up the next morning I at first think that all my settings are lost. After looking around and checking out some files and folders I figure out that I am logged in to the root profile.
I don't know if the problems I was having before had anything to do with it or not. I was trying to update manually because it had not updated in a couple of weeks and so I went looking to see if there were any updates. There were and the u rddate managers were not updating. It would give me an error message about something like it was not finding the server and the server was either down or no longer existed. So I found the page on the server and typed it in somewhere manually. Then I updated. It was after this that I started to have the problems with my profiles.
 So now I am wondering if I add: PATH=$HOME/vin:$PATH" To ".bash_profile would that fix it?

Revision history for this message
enawn00 (enawn00) said :
#9

I have been looking in my .bash? files on my workstation and comparing them with my laptop and I do not see a difference between either. I also compared profiles. I did this for both the user's profiles and root in both. There is no difference that I can see in either profile.

Revision history for this message
Larry Jordan (larryjor) said :
#10

     I'm also wondering, if you go to Users & Groups (System -> Administration -> Users & Groups) and check the Properties on your profile... on the Advanced tab does it show your own home directory and group? Your group should be your user name. You MIGHT have to unlock it to check anything else, but you should be able to see that root's Properties under the Advanced tab have root as the Main Group and /root as the home directory.

Revision history for this message
enawn00 (enawn00) said :
#11

Yes everything you said is true except that home directory is set to root. I have unlocked several times and changed the path to no avail. If I could somehow log on as root and change this perhaps I could solve this problem also. I have tried to sign on as Sabayon user and it doesn't help either. Is there any way to change this from the terminal (command prompt)?

Revision history for this message
Best Larry Jordan (larryjor) said :
#12

     Didn't mention it before, but a normal user's id is usually 1000 or more. The user id for root is zero (0). So that may override changing your home directory if your user id is set to 0.

     Still think the best way, if you don't have other users on your system, is to go with changing the properties under Users & Groups. If there are no other users on your computer but you and root, try setting the home directory correctly and setting your UID to 1000. If there are, check their user id's first to make sure you aren't trying to take someone else's.

     If you get no effect from that, you can try the command line option. The 'usermod' command should do it. Problem then, is how did it get changed in the first place? If a malicious program installed a command in a startup file (whether the init.d variety or startup script or a line in your .profile, whatever), it may change back when you start up again. In that case, you may have a hard time tracking down the real problem, but for now, try using:

sudo usermod --home (your true home directory) --shell (presumably bash?) username

There are other options that can also be changed from a command line, such as userid and groupid(s).

     Believe from the man pages you can call with just 'sudo usermod $username' and it will check to see if a home directory is already assigned to the username.

Revision history for this message
enawn00 (enawn00) said :
#13

Thanks Larry Jordan, that solved my question.