Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have recently been granted access to a machine at work. However, I have been having trouble setting up my development environment. Relevant information about the machine:

$ uname -a
Linux blackhawk2 3.2.0-41-generic #66-Ubuntu SMP Thu Apr 25 03:27:11 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

I use OpenSSH to login into to this machine remotely. The thing I noticed immediately, was that my home directory was not set properly.

$ echo $HOME
/

Further my shell of preference is Bash, but:

$ echo $SHELL
/bin/csh

I am aware that the home directory and the default shell is setup in '/etc/passwd'. Inspecting this file I find:

glperez:x:1015:1015:glperez,,,:/home/glperez:/bin/bash

EDIT: My home directory definitely exists and '/bin/bash' is working properly. Also, user authentication is handled over an authentication server of some kind. Unfortunately, this information is not readily available to me at this moment.

The strange thing is that on both occasions that I have tried to fix this problem, the first log in results in the expected behavior. That is, my home directory is correctly set and my shell is Bash. Upon logging in again, the problem shows up.

share|improve this question

4 Answers 4

Read man 1 login, read /etc/login.defs. Also see what you have in $PATH, $LOGNAME.

I'd make sure that /home/glperez really exists, with ls -ld /home/glperez. If it does not exist, and /etc/login.defs permits, you will be given a directory that login is sure exists, /.

You can also check that /bin/bash exists, is executable, and is included in /etc/shells

ls  -l /bin/bash;ldd /bin/bash;grep /bin/bash /etc/shells  

You should ask blackhawk2's sysadm how s/he created the glperez account. useradd or adduser? What parameters? Are you supposed to have an encrypted home directory? Does blackhawk2 authenticate users locally, or over the network (check /etc/nsswitch.conf)? If over the network, what does that server think of you?

share|improve this answer
    
Thanks for the response waltinator. I will answer your questions by editing my question. –  Daeden Aug 23 '13 at 6:54

If you are sure that you have exactly this line:

glperez:x:1015:1015:glperez,,,:/home/glperez:/bin/bash

in /etc/passwd file, then you should check all your shell initialization files like ~/.bashrc, ~/profile and so on. Most probably you have something like the following commands in one of those files:

ksh              #change the shell to ksh
cd /             #chenge the working directory to /

HOME=/
SHELL=/bin/ksh
share|improve this answer
    
Thanks for the response. I have checked all initialization files and nowhere is my HOME or SHELL changed. As I mentioned in my edit, when I log on for the first time everything is fine (although public key authentication is not working) all subsequent attempts to login result in my problem. –  Daeden Aug 23 '13 at 8:12

The following will run bash similar to the way it gets run when you log in, but outputs the filename and line number of each command it runs. It should help you figure out where it changes the SHELL variable.

PS4='+ $BASH_SOURCE:$LINENO:' bash -xlic ''
share|improve this answer
up vote 0 down vote accepted

The problem is/was with my UID. For some reason, my UID is not consistent.

It seems like something is going wrong when username is being looked up and I am given a temporary UID.

I am now in contact with a system admin to solve this.

Thanks for all the responses!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.