its possible to run Ubuntu as Terminal (?) server? I want to use my PC as Ubuntu desktop and sometimes use my laptop to connect to pc login to same account and run everything as on my pc. PC will be a server where most of computing will work laptop will be only a terminal. I see something like this on my school but I'm not sure how it's on server side. Sorry for my English it's not my native language ;-)
Yes, your PC can be used as a server.
For "terminal" access you'll need a OpenSSH Server installed on your PC.
sudo apt install openssh-server
Once it's installed you should be able to reach your PC from your laptop, as long as you're in the same network (LAN).
Let's say your PC has local IP: 192.168.123.456
Then you can connect to its terminal with ssh:
Where "login" is your PC account name.
You can check your local IP with:
ip a s
Keep in mind that running OpenSSH without additional configuration is not safe.
You should take additional security measures to make sure that your PC is safe with OpenSSH server running.
To secure your SSH server you should at least edit your /etc/ssh/sshd_config
sudo editor /etc/ssh/sshd_config
Prevent login into root account with:
Disable password authentication
and use ssh-keys instead:
Also append new line at the bottom of the file with:
to make sure that only this account can be used with SSH.
Also read more on SSH security here:
Preventing brute force attacks with fail2ban
With fail2ban you can prevent brute force attacks, targeted on your SSH Server.
You can install fail2ban with:
apt install fail2ban
In case you change your SSH port please remember to change it also in fail2ban configuration.
Let's say you've changed your SSH port from 22 to 2222.
You can set it in /etc/fail2ban/jail.d/defaults-debian.conf
sudo editor /etc/fail2ban/jail.d/defaults-debian.conf
so it looks like this:
[sshd] enabled = true port = 2222
Then restart fail2ban with:
systemct restart fail2ban
Network settings and firewall
- If you want to reach your SSH Server from outside your LAN you will need to forward SSH port in your router's settings to be able to connect your SSH Server via public IP.
- In case your public IP is dynamic you will also need to set DDNS (dynamic DNS) service with a domain name, to be able to connect your SSH Server with this domain name, even if your public IP will change.
- Consider setting up a firewall with iptables to control connections made to your SSH Server.
With ssh you have the terminal and might even start something graphical but if you just want access to the desktop like in virtual desktop the easiest way to do that is with vnc server and vnc client. Also Remmina works good. VNC clients and server are in the standard Ubuntu repository so they can be found and installed with the standard Ubuntu Software. The advantage of VNC is that there are clients on most Operating systems so a laptop or machine with windows, (any)linux, mac, android will work. If you tweak the server settings you can even connect with an old dos machine.
I remember fiddling with this and I stumbled on having to poke a port 23 or 5900 hole in the serverside ubuntu firewall to get it working.