Ssh – Set initial path for a SSH config host

configurationhostsssh

What would I have to add to a SSH hosts entry in my config file so that everytime I ssh into that host, I get sent to specific initial path?

Host foobar
    HostName    foobar.com
    User        foobar

Best Answer

While the existing answers are fine, not one person specifically mentioned that setting the home directory is done in the password file.

You can change the home directory by editing the /etc/passwd file (use vipw) or running the following command:

usermod -d /user/wants/this/path username

Utilities and methods differ between UNIXes, I'm assuming Linux. Modifying /etc/passwd directly will work for all of them.