We help IT Professionals succeed at work.

How do I change $HOME when I ssh to different servers

pogosru
pogosru asked
on
Medium Priority
275 Views
Last Modified: 2010-03-18
When I ssh to server1, $HOME=/home/user
When I ssh to server2, $HOME=/Network/Servers/home/user

How do I change the $HOME varaible so it points to the directory I want when I ssh to the server?
Comment
Watch Question

Top Expert 2005
Commented:
export HOME="/new/home/value"
Also You may set it in Your startup file .profile (or .bash_profile) in Your true home directory.
but note, that HOME is set automatically to Your proper home directory, changeing it may trick some applications, and therefore prevent them from working properly.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
I was kind of hoping there was a way to do it, so that when I ssh'd it would automatically be the correct HOME without the export. How is HOME automatically set to the proper HOME directory? I have only one true HOME directory. But with ssh it changes with different servers
Top Expert 2005

Commented:
Well, You can have different HOMEs on different servers - right?
Your home is saved in /etc/passwd file, and the var HOME is set to whatever /etc/passwd says upon login (no matter if ssh or local terminal).
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.