Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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'm using tmux and zsh, and I've recently been learning about ssh-agent and keychain. From the manpage for zsh, it says that it will source .zlogin only if the shell is, well, a login shell.

Following advice I read, I stuck keychain --clear in my .zlogin, which worked perfectly. When I logged into the box I had to unlock my key. However, each time I create a new window in tmux, it clears/makes me re-add my key. This is a little annoying... but I can understand it if, in fact, each new tmux window is a login window.

I haven't been able to find much help outside of the manpages on this topic. So is each new tmux window a login shell, or is there any way that I can make it not clear my keys only when I create a tmux window?

share|improve this question
Are you primarily concerned only about the ssh passphrase? – Keith Oct 10 '12 at 21:46
Well, obviously (I hope) I don't want to just have empty passphrases on my ssh, but yes - I would just like it to keep my ssh keys loaded unless I am, in fact, logging in again (either through ssh or tty, or through X, I suppose) – Wayne Werner Oct 10 '12 at 21:50
up vote 1 down vote accepted

Each new window is a login shell. You can change this by setting the value of default-command in your .tmux.conf file:

set-option default-command zsh

By default, it creates a login shell of whatever value is set using the default-shell option (whose own default comes from your SHELL environment variable, presumably /bin/zsh or similar, based on your question).

The default behavior is as if you had the following line in your .tmux.conf:

set-option default-command "zsh --login"

(At least, I think that's how you can explicitly start a login shell with zsh.)

share|improve this answer
Works perfectly! (At least, it doesn't ask for my password, which as far as I've read means it's doing what I want ;) – Wayne Werner Oct 11 '12 at 22:10

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.