Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have recently installed Raspbian into a Raspberry Pi. As part of the installation process I changed the user name and group from the default (pi) to my own (let's call it user) using usermod and groupmod. I also moved the home directory (/home/pi) to the new user name (/home/user) using usermod. Everything works fine except that when I login using SSH instead of landing the new user directory (/home/user) I end up at the home directory (/home). Any idea why this may be happening? Any solution? It's not a big deal but it is confusing me.

The directory /home/user exists with permissions 755. In addition to that the /etc/passwd file contains an entry that looks like the following:

user:x:1000:1000:User:/home/user:/bin/bash

To me everything looks fine, but still when I login from ssh I get a prompt that looks like user@raspberrypi /home $.

share|improve this question
    
You may have better luck with this question at the Raspberry Pi Stack Exchange. –  Michael Hampton Sep 8 '12 at 10:35
1  
@MichaelHampton Raspberry Pi tends to migrate questions purely about software to Unix & Linux, actually. I think this question would be considered off-topic on Raspberry Pi. –  Gilles Sep 8 '12 at 13:06
    
What's the content of your ~/.bash_profile, ~/.profile, ~/.bashrc (if they exist)? If you run ssh raspberrypi pwd and ssh raspberrypi 'echo ~', what does it show? –  Gilles Sep 8 '12 at 13:09
    
I tried both your commands and both return /home/user (where user is the actual username). The contents of the other files (they do exist) is the default that comes with Raspberry Pi. –  Pere Tuset Sep 8 '12 at 13:11
add comment

1 Answer

did you use the -m option when you used usermod -d ?

if not, then you need to actually move the home directory as well as change the entry in /etc/passwd.

This will rename /home/pi to /home/user if /home/user does not already exist:

cd /home
[ ! -e user ] && sudo mv pi user

oterwise, check that user's home directory is actually /home/user and not just /home...here are some of the methods you can use to find out a user's home dir:

grep '^user:' /etc/passwd      # works for system-local accounts only

finger user                    # requires finger to be installed

pinky -l user                  # part of GNU coreutils

getent passwd user             # should work no matter where the account
                                 data is stored
share|improve this answer
1  
The directory /home/user exists with permissions 755. In addition to that the /etc/passwd file contains an entry that looks like the following: user:x:1000:1000:User:/home/user:/bin/bash. To me everything looks fine, but still when I login from ssh I get a prompt that looks like user@raspberrypi /home $. Any further ideas? –  Pere Tuset Sep 8 '12 at 12:15
    
very odd. have you checked your log file to see if there are any error/warning messages from sshd? try /var/log/messages, /var/log/syslog and/or /var/log/auth.log –  cas Sep 8 '12 at 22:41
    
also, what happens when you type cd and hit enter (it should take you to your home dir). –  cas Sep 8 '12 at 22:42
    
also, i just noticed that you said the prompt says ... /home $. did you check if that's correct? it might just be a problem with your prompt string, $PS1 . run pwd to print the current working directory name. –  cas Sep 8 '12 at 22:44
1  
Also, what is the ownership of /home/user? –  Shadur Sep 21 '12 at 9:14
add comment

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.