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

Posted on 2006-03-28
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?
Question by:pogosru
    LVL 43

    Accepted Solution

    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.

    Author Comment

    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
    LVL 43

    Expert Comment

    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).

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
    Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now