Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

/var/www/websites

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
add comment

1 Answer

up vote 10 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
add comment

Your Answer

 
discard

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.