tags: #linux #remotework #homeoffice #ssh #remotedesktop
I'm not comfortable to work on a laptop during all day. I prefer working with a mouse, keyboard and a screen at head height. When I work remotely, I had to make space on my desktop, push the keyboard away, disconnect the screen, reconnect it to my laptop and even after all of that, I have not so much space. I wonder if another solution exists, a simpler one. Can I use my laptop as a server ? How ? My first idea was Remote Desktop.
This is a solution provided by Microsoft and permits to control your PC from another one. This is very good if you have Windows on your laptop. Later, I change for Debian, so I have to install the `rdp` package and it works well. Then I installed Wayland (a new alternative to X11 window manager) and it works less well ^^. So I tried to find another solution.
Slow, blurry and a pain to make it work. I abandonned quickly.
I know why I didn't try to work over SSH before. I had to learn Vim but it was a very good experience. Vim is a very powerful terminal text editor and good at modifying text. At this time, I was on a long going project, it was perfect but now, I'm on a new project, and for a new project, I prefer to use VS Code. It's easier to create files, move files, ... I tried some other terminal text editor to find one that can fit my needs. And finally, I found the missing link: the "Remote - SSH" extension for VS Code. Like "Remote - WSL", "Remote - SSH" install a VS Code server on the remote machine and allows to edit, create files remotely like on your local machine.
However, care must be taken to create a suitable dev environment:
- I bound my "localhost" servers to my laptop IP to access it anywhere from my home.
- I created a shell script to launch tmux windows for each server I need to launch and i don't have multiple graphical terminals or graphical windows/tabs to manage my servers. Just one connection to manage all ^^
- I disabled the Desktop environment
- I lowered the brightness to 0
# start in terminal mode (not graphical.target) systemctl set-default multi-user.target # extinguish the screen backlight brightnessctl set 0 # I can also turn the screen off but I didn't find a simple command to do that at this moment.
- The code stays on my business laptop.
- My home computer remains my home computer.
- Additional power usage is minimal, the laptop is used as a server, desktop is used as a graphical client.
- Easy to setup. No need of special softwares you need to remember and configure. SSH + tmux + "Remote - SSH" extension = Happy developer
Now, I just have to start my laptop, connect it to the ethernet and it's done.
Hope it will help someone one day.
Be lazy, be smart.