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

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?
pogosruAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ravenplCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pogosruAuthor 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
0
ravenplCommented:
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).
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.