Send a single command through tmux at the start of every pane every session

I am using a Solaris server which I cannot alter even as a normal user for “security reasons”, but I still have to daily interact in it.

TLDR I have absolutely no root access to the server, no way to add files in the $HOME and I just want to set up a few tweaks. While using TMUX, all my custom preferences are flushed for the default profile which I can’t work with.

I need a method to launch a command (either launch a script or a stty erase ^? ) at every tmux instanctiation.

For context, it was forbidden to use any profile / session alteration as several users go through the same user and the $HOME, .profile and the shell cannot be switched. This also means I cannot change any config file in their default directory.

What I did was :

  • Launch a first command with my ssh -t connection, which allowed me fix the stty erase ^?
  • Set a few env vars in a script, which cannot be launched at connection from login, unless I add it in the SSH args as a command on login.
  • Set a few aliases in a folder. The aliases are pretty much : vim -u ./myfolder/.vimrc or the same with tmux tmux -f ./myfolder/.tmux.

Now I have set up every but the terminal stty erase ^? keeps erasing on every pane, session I set in TMUX. I’ve read a lot about sending a command on the creation of a session or on multiple windows but nothing about having a small command on the start of any tmux pane, window, session.

Is there any way to do that ? The closest I got was reading the tmux configuration from Arch : https://wiki.archlinux.org/title/Tmux

I noticed you could start a non login session or set up custom keys, but both methods failed.