What you are searching for, it is a remote desktop software [rds].
On the machine without keyboard you will run the server, on the other the client.
There are many [1],[2] that can change in time. A good start can be the free version of nomachine [1]
To exit from a simple session instead, you have to find the relative command and invoke it even through an ssh connection, e.g. in gnome:
gnome-session-quit --logout --no-prompt
Remember that you can always make restart the login manager with commands like sudo service lightdm restart
, or stop
and after start
, but this will close the whole lightdm
and not only your current session.
Instead to run from remote a graphic application it is enough to connect with ssx -X
to enable the X11 forwarding, or -Y
, and run the command.
ssh -X
,xhost +
, then let start the session managersudo service lightdm restart
and operate from remote.