Find the answer to your Linux question:
Results 1 to 5 of 5

Thread: /etc/passwd

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1



    I have had a slightly annoying (but not fatal...yet) encounter with bash when I change /etc/passwd. I just changed one persons home directory, and now, wehn I log in as any user other than root in SSH, I get -bash-2.05b$ rather than the normal [user@server dir]$

    I even tried undoing the changes in /etc/passwd with no avail. How can this be fixed?

    Thanks in advance!

    If you love something, emerge it

  2. #2
    is it advisable to edit the /etc/passwd directly? if one has to change a user's password and home directory, login shell, doesn't one use another admin tool, like passwd and usermod, respectively?

    Registered User #345074

  3. #3
    Linux Engineer Giro's Avatar
    Join Date
    Jul 2003
    You can edit the passwd file directly and it seems that this is more a profile problem check your /etc/profile seems like this new user is not picking its profile up try 'source /etc/profile' and see if you get the right prompt then.

  4. $spacer_open
  5. #4
    I think I have figured out the problem...but I don't know wht it wasn't working last time I went back to the users original home. It needs all the .bash_* in the old home directory, including the users bash profile...but what gets me the most is it affected other users when the user didn'thave these files.
    If you love something, emerge it

  6. #5
    There are two sets of profiles and environment setup scripts that are run when a user logs in. When a user first logs in the global profile is run and the environment is setup. (/etc/profile) and then the user's profile is run. The user's profile takes precedence over the global profile.
    You may be interested in the following files:

    /etc/profile - processed first
    /etc/bash.bashrc - called by /etc/profile
    $HOME/.bash_profile - called next - should call $HOME/.bashrc
    $HOME/.profile - called if no .bash_profile.

    I believe I have the order correct however I am not 100% sure.
    Generally not a good idea to edit the global ones unless you need to.
    Without any of the above you will not have environment variables. ie no PATH and therefore you would have to type the full path to the command etc

    $ env
    will show you environment variables.

    /etc/skel/* - these are used to setup a new account. Can also copy them to your home directory if you have deleted the old ones. Make sure you change the ownership of the files after copying.

    Generally speaking it is not a good idea to edit the passwd, group and shadow file with vi in case someone else is also editing it. It is better practice to use useradd etc, groupadd etc and passwd.
    If you are the only user on a box you can generally get away with it if you know what you are doing but it is not best practice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts