I am using tmux on a linux machine. I ssh into the linux machine from a mac osx machine but the tmux commands are being applied to my mac terminal instead of the tmux on linux. For example, control+b+d would close the tmux window on linux but instead it is intercepted by my mac terminal and creates a split panel instead. How do I send the command through to tmux?
This is a bit confusing. Are you running tmux on your OS X machine as well, so there are two tmux? If so, you need to press C-b C-b (two C-b to send the prefix through to the inside tmux).
If not, it sounds like your terminal uses C-b for something else, you can either change the prefix in tmux to something your terminal doesn't use (see https://github.com/tmux/tmux/wiki/Getting-Started#changing-the-prefix-key), or configure your terminal not to use C-b.
Related
How do you setup VcXSrv.exe on Windows 10 to work with WSL2 without disabling access control? Every description on the internet shows to disable the access control, but this allows any program on the local network to log your keystrokes and mouse movements among other things.
Rather than disabling access control on VcXSrv, you should use the .Xauthority file to share keys between your X11 clients and the VcXSrv X11 server. The .Xauthority contains a collection of authorization keys indexed by the DISPLAY . You'll need to setup this file with a key for your particular Windows host and share that file between the VcXSrv and your X11 clients running on your WSL2 distro. To setup this, follow these steps:
Run your WSL2 distro (Assuming this is a debian based one) and install xauth, md5sum and gawk or awk. We'll also install some X11 client to test our setup. In this case, we'll install gnome-terminal but you can install something else if you want. On an Ubuntu distro, you can do:
sudo apt install -y xauth coreutils gawk gnome-terminal
xauth list # this should be an empty list
magiccookie=$(echo '{some-pass-phrase}'|tr -d '\n\r'|md5sum|gawk '{print $1}')
xauth add host.docker.internal:0 . $magiccookie
cp ~/.Xauthority /mnt/c/Users/{WindowsUserName}
Add the following to either your ~/.bashrc in your WSL2 distro home dir
export DISPLAY=host.docker.internal:0
We need to create either an XLaunch configuration file (i.e. config.xlaunch ) or
a shortcut to VcXSrv.exe with the desired command line args. XLaunch is a simple launcher
that assists in setting up the arguments and in turn calls vcxsrv.exe. We'll ignore using XLaunch and
just create our own shortcut with the appropriate arguments.
We want to run VcXSrv.exe with these args:
vcxsrv.exe -multiwindow -clipboard -wgl -auth {.XAuthority file} -logfile {A Log file} -logverbose {int log level}
From above, we copied the .Xauthority file to /mnt/c/Users/{WindowsUserName}/.Xauthority which means our desired command line is:
vcxsrv.exe -multiwindow -clipboard -wgl -auth "c:\users\{WindowsUserName}\.Xauthority" -logfile "c:\users\{WindowsUserName}\VcXSrv.log" -logverbose 5
Feel free to omit the logfile and logverbose options if you're not debugging any issues. So you can just do:
vcxsrv.exe -multiwindow -clipboard -wgl -auth "c:\users\{WindowsUserName}\.Xauthority"
Remember to replace {WindowsUserName} with the name of your folder under c:\Users.
To create the shortcut, navigate to where VcXSrv.exe is installed. The default location of this is
C:\Program Files\VcXSrv\VcXSrv.exe
In the explorer file window, right click on the VcXSrv.exe and click "Create Shortcut" . This will create a shortcut
on your desktop.
Right click over the created shortcut icon, and select properties.
In the Shortcut tab, append the arguments above after the executable . It should look something like:
"C:\Program Files\VcXSrv\VcXSrv.exe" -multiwindow -clipboard -wgl -auth "c:\users\{WindowsUserName}\.Xauthority"
In the General tab of the Properties dialog, change the name to be "VcXSrv with XAuthority".
Click ok.
Now you can start the X11 server by double clicking on the shortcut.
If you wish to have the X11 server started at startup, follow the instructions here:
https://support.microsoft.com/en-us/windows/add-an-app-to-run-automatically-at-startup-in-windows-10-150da165-dcd9-7230-517b-cf3c295d89dd
Now back in the WSL distro terminal, you should be able to run
the gnome-terminal or other X11 client and have it display securely
on the VcXSrv X11 server running on the Windows host.
export DISPLAY=host.docker.internal:0
gnome-terminal
This should result in the gnome-terminal being displayed on your X11 Server. Further, the xauthority file will be used to allow only authorized clients to connect to your X11 server.
I am sshing into a mac running zsh but each character that I type is remembered and repeated. For example, if it type exit, I see eexexiexit on the screen but the command exit is executed.
If I type directly on the remote machine, there is not a problem so it is the communication via ssh that is the issue. I have no idea how to solve. Any suggestions?
I realised that I just needed to ssh into the remove server with the following command: 'TERM=screen-256color ssh ...
I have a W10 machine with bash set up. If I open a cmd window and type bash -i I can get to a bash shell no problem. However, if I enter the W10 machine using psexec and the same user and type bash -i, everything just hangs.
I know I can and do use an Ubuntu ssh server to get in, but I can only do that if the Ubuntu ssh server is running. It only seems to run if there is at least one bash session active. I thought I could use the psexec entry as a backup and start the Ubuntu ssh server or do anything else, but from the psexec cmd window, I cannot get to bash. When I type bash -i everything hangs and I need to close the cmd window on the remote machine.
The same problem occurs if I use a windows ssh server. I can get to a cmd window, but everything hangs if I type bash -i.
I also tried the Windows task scheduler to try to start the Ubuntu ssh server at a user login, but that also just hangs.
I'm running a Windows 8.1 guest on a Mac OSX 10.11 host, via Vagrant. I want to pass in a script to this guest via command-line. If the guest were Unix-based, I could just do vagrant ssh -c "$THE_SCRIPT" my-unix-box and call it a day. When I try for the Windows guest, I'm told that the command bash does not exist.
However, I can vagrant ssh into the Windows guest without specifying a command just fine. The resulting shell is cmd, not PowerShell or Bash or similar.
How can I execute a script on a guest Windows Vagrant box (from an OS X host) by passing it in on the command line? Vagrantfile configuration, guest software to install, or similar. I'm not picky about which shell ultimately runs my script.
It turns out you can pass the script to vagrant with double-dash separation, like so:
WINDOWS_THINGS="..."
vagrant ssh windowsBox -- "$WINDOWS_THINGS"
In my case, this will run the contents of WINDOWS_THINGS as a cmd script. I guess the interpreter used depends on the underlying box, but whatever the case this solved my problem. Someone on IRC suggested this to me, and unfortunately I don't remember their name. But, if you're reading this, thank you!
I use Archlinux 32-bit on an old Lenovo X60 Thinkpad. It works great but I have a problem with tmux: Whenever I try to launch tmux as a normal user in st-terminal or in xfce4-terminal (or I guess in other terminal emulators too) I get the following error:
setterm: terminal screen does not support --blength
/usr/lib/xorg-server/Xorg.wrap: Only console users are allowed to run the X server
After that message there is no way to input any commands and a few seconds later tmux stops. I use tmux inside a terminal emulator that is launched in i3wm inside an xserver.
The strange thing is that if I start tmux as root user (sudo tmux) I only get the setterm-error but after that I can use tmux as normal. So I guess that something in my xorg config is damaged but I can't figure out what. So does anyone has an idea?