Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering if there is a way to change the default directory that I get put into after I SSH into my Ubuntu server.

99% of the time when I'm logging into my server, it is to access files within a specific directory:


Is there a config file that I can edit that will make sure I am put straight into this directory when I login?

share|improve this question
up vote 19 down vote accepted

There are two ways to achieve this:

  • Change your homedirectory on the server to /var/www/websites (this is not really a good idea)
  • add cd /var/www/websites to the end of your .bashrc. I use this one on our puppetmasters as I always want to be in /etc/puppet/environments/dkaarsemaker there instead of my homedir :-)
share|improve this answer
Thanks. I edited the bash.bashrc file which was located in the /etc directory. Worked a treat :) – Bob Flemming Apr 16 '13 at 8:56
Ooh, I would not do that, as it affects all users. Better to edit /home/yourlogin/.bashrc – Dennis Kaarsemaker Apr 16 '13 at 20:16
Oh ok, thanks for the tip! – Bob Flemming Apr 17 '13 at 8:33

Your Answer


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.