Reputation: 443
I usually ssh into my aws account then immediately change directory to my working directory.
I am now using an alias in my .zshrc file for the ssh command. However , ideally, I'd like to ssh in then change directories automatically with my alias command. Cant figure out the cd part on the remote server. My alias looks something like this now:
alias aws="ssh -i ~/.ssh/mykeypair.pem [email protected]"
Upvotes: 0
Views: 1860
Reputation: 25936
I think the preferred way would be creating ~/.zshrc
or ~/.bashrc
file on your remote host or appending to the end just:
cd your/working/directory/
Just tested and works fine for me
Other way would be changing your alias to something like:
alias aws="ssh -tt -i ~/.ssh/mykeypair.pem [email protected] 'cd your/working/directory/; bash'"
Additionally you can change bash
for zsh
if you want to use zsh
as your shell on remote host.
Upvotes: 1