We have more than 500 systems running ubuntu in our office. And sometimes after installation we forget to enable to Remote desktop. So that we was not able to control that PC remotely. Is there any way to access that machine remotely using SSH? Coz ssh was installed in that remote machine. Also if that machine was in login screen we was not able to view through vnc. I guess SSH will be a good solution. Can anyone help me? Thanks in advance.
How to Access a Machine Through VNC Using SSH
sshvnc
Related Solutions
Method 1 :
This can be achieved with vino vnc server & remmina (both come default with ubuntu; if not install it by running sudo apt-get install remmina
). Then Run Following commands from local computer in terminal prompt:
ssh -Y gman@remote
. Use trusted X11 forwarding, otherwise it wont workvino-preferences
. It will open vino-preferences.Also Click
configure network automatically to accept connection
. But don't enter any password, its base64 encoded. Then click close. Then run:sudo -s export DISPLAY=:0.0 xhost + /usr/lib/vino/vino-server &
It will start the vino server.
Logout from server:
xhost - Press CTRL+C twice exit exit
Then open remmina. Choose
vnc
under protocol.Under
basic
tab put server address inserver
field.On ssh tab click
enable ssh tunnel
. Underssh authentication
, it could bepassword
orpublic key
:Click save. And then double click connection-name(home-desktop as shown in the picture) to start browsing remote desktop.
Method 2:
x11vnc
is a simple VNC server and you won't have to mess around with Gnome settings or 500 firewalls, just install x11vnc
on all your computers (with puppet or whatever you're using for mass-control).
Then from your local computer run:
ssh user@host -L 5900:localhost:5900 "x11vnc -display :0 -noxdamage"
Obviously swapping user@host
for the username and hostname/IP of the remote computer.
And then use a VNC client of your choice to connect to localhost:5900
. The SSH command starts a vnc server on the remote computer and then tunnels back that port over SSH. You don't have to open up any ports (as long as you can already SSH).
If your computers have funny display settings, you might do better to leave off the -display :0
segment in the SSH command. x11vnc
will then automatically try to find the right display.
Source: askubuntu
In another forum, forum.developer.nvidia.com, "nekokeitai" wrote something which worked for me. These commands can be used via ssh on the remote Ubuntu 18.04 PC:
Install vino:
sudo apt install vino
Find the UUIDs of your connections and use them as a comma separated list inside the square brackets of the last configuration line. I have only tried one UUID inside the single quotes, though:
nmcli connection show
Configure vino:
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false
dconf write /org/gnome/settings-daemon/plugins/sharing/vino-server/enabled-connections "['']"
Start vino:
export DISPLAY=:0 && /usr/lib/vino/vino-server
Now, on the local PC use remmina with VNC protocol to connect to the remote PC.
Best Answer
Use SSH to get to the machine. Ask gnome not to ask, "Are you sure?" after enabling the remote desktop access. Then enable remote access.
You could create scripts for this, too, maybe /usr/local/bin/start-remote-desktop.sh.
Use your favorite editor over vim if you like...
The contents of that file:
Make it executable:
Add it to your default user configuration:
As far as the human factor goes in maintaining 500 workstations, you would love using CloneZilla. The one CloneZilla server provides pre-configured images for the workstations which can be installed over the network. You can even multicast them so that in just a few hours, to guess, all the workstations can be imaged with a common configuration, same version, etc... There's a good tutorial on dedoimedo.com.