search

Wednesday, October 7, 2015

How to open browser (Chrome, Firefox) on the remote machine via terminal

You can open a chrome window on the remote machine via terminal with X11 forwarding. First of all, some configuration needs to be done. Open on your machine (client) ssh configuration:
vim ~/.ssh/config
Make sure that it contains:
Host *
  ForwardX11 yes
Check that on the server (remote machine) X11 forwarding is enabled. Open this file:
vim /etc/ssh/sshd_config
and check that it contains:
X11Forwarding yes
X11DisplayOffset 10
Now you can connect from your machine to the remote server with command:
ssh -Y your_name@server
Check with (env command) that environmental variable DISPLAY is something like localhost:10.0. If not, set it with command:
export DISPLAY=localhost:10.0
To check that everything was set up correctly, run on the remote server:
xclock
You should be able to see a window of the xclock application. Now you are ready to run chrome with command:
google-chrome
I had some permission issue that prevented chrome from starting, I managed to fix it by changing user data directory:
google-chrome --user-data-dir=.chrome_profile
This also might be useful:
google-chrome --no-sandbox 
Firefox can be launched just with:
firefox 
Make sure that you have permissions for the .mozilla and .cache directory on the remote machine

git: How to change the author of the commit

If you want to change the author of the specific commit (for example the latest one), run rebase command:
git rebase -i HEAD~1
HEAD~1 points to the latest commit, but it can be a commit id or branch name. To mark a commit for edit, replace `pick` with `e`: Replace commit author:
git commit --amend --author "Your Name <your.name@mail.com>" 
Finish rebase:
git rebase --continue