This is written for newcomers to the lab, who often experience X11 connection rejected errors when running gnome-terminal (you need this to run atom, sublime text etc to edit on a remote server).
For more info, read the full answer on StackExchange https://unix.stackexchange.com/questions/412065/ssh-connection-x11-connection-rejected-because-of-wrong-authentication
echo $DISPLAY
This should display your current X11 display
xauth list
If nothing prints on console, it means ssh did not automatically generate the X11 authorization cookies on the local display properly
xauth add $DISPLAY - `mcookie
This adds your display's authorization cookie to the xauth
xauth list
Check whether your display is added
xauth nextract ~/xccookie $DISPLAY
exit
On local: scp user@remote:~/xcookie ~/xcookie
On local: xauth nmerge ~/xcookie