Right. I have ssh keys set up so I can get into each of the servers as my account, but there's a single account we use to run most of our hadoop processes, etc. So after logging in, I need to do sudo -u username -s or something like that.
It's not that it takes a lot of time or anything. It'd just be super nice to be able to attach tmux and have all of the sessions already connected.
Right now I'm doing something like this:
function tmux-sr() {
tmux send-keys "lockfile -r 100 $SSH_LOCK \
&& ssh -t $ENTRY_SERVER sudo -K \
&& ssh -t $ENTRY_SERVER \"echo \$(vpn_password) | sudo -u $ENTRY_USER -S -i uptime\" \
&& rm -f $SSH_LOCK \
&& nocorrect ssh -t $ENTRY_SERVER sudo -u $ENTRY_USER -i $*" C-m
}
vpn_password is an alias that extracts my password from the keychain.
This works well enough, but I feel like there has to be a better way.