title: How to execute a series of commands after logging in to a remote server over SSH?
body: <p>I want to login to an interactive shell on a server using SSH and, after logging in, execute two commands. </p>
  
  <p>This works: <code>ssh user1@server -t "cd /home/user2; bash --login"</code></p>
  
  <p>None of the following work:</p>
  
  <p><code>ssh user1@server -t "cd /home/user2; bash --login -c 'source /home/user2/.bashrc'"</code></p>
  
  <p><code>ssh user1@server -t "cd /home/user2; bash --login -c source /home/user2/.bashrc"</code></p>
  
  <p><code>ssh user1@server -t "cd /home/user2; bash --login source /home/user2/.bashrc"</code></p>
  
  <p><code>ssh user1@server -t "cd /home/user2; bash --login; source /home/user2/.bashrc"</code></p>
  
  <p>When I call ssh with the -v flag, I see the following before the ssh session exits:</p>
  
  <pre><code>debug1: Sending command: cd /home/user2; bash --login -c "source /home/user2/.bashrc"
  debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
  </code></pre>
  
  <p>I know this might look odd; I need to login as user1 so that I can use software (legally) that can only be run by user1, but I want to run my personal .bashrc and work in my personal working directory. I can not modify /home/user1/.bashrc. Is there any better way to do what I'm trying to do?</p>