Schlagwort-Archive: vncserver

Virtual Network Computing, kurz VNC, ist eine Software, die den Bildschirminhalt eines entfernten Rechners (Server) auf einem lokalen Rechner

Run Nano as root in vnc session

How to Run Nano File Manager as root in a VNC Session

In this post I show how to run Nano file manager as root in a VNC session. I’m using a Fedora Cinnamon Spin to this logged in as an common user via VNC viewer.

Fire up a terminal and insert the command below at the end of .bashrc by hit nano ~/.bashrc

 this example use vncuser, enter your username instead.

close the terminal and re-open again, hit the command line below to run nemo as root:

As the video shows below.

could not acquire name on session bus

VNCSERVER – could not acquire name on session bus

 If you see this message, then your VNC configuration is incorrect or not complete!

Cause

cause deployment of user environment that not performed automatically during installation process of vncserver.

Solution

See this tutorial here in this blog, it shows the complete installation of vncserver suitable for most known distributions.

How to Install VNCSERVER on CentOS

VNC on Linux Server bring virtual graphical desktop to UX, Windows and macOS clients

 

Virtual Network Computing – This tutorial describes how to deploy vncserver on Fedora, CentOS and RHEL. VNC or Virtual Network Computing is a graphical desktop that allows to control a host computer (Terminalserver) remotely from a client computer. A VNC server redirects the keyboard and mouse entry from the client computer (VNC viewer) to the host computer, like known from Windows Remote Desktop Protocol RDP also known as Remote Desktop Services RDS.

This guide explain on how to set up a VNC server on CentOS 7 prepare with minimal installation and running as virtual machine. The server installation are based on Linux Mate workspace, however setup and configure VNC server using TigerVNC.

Contents

  1. System Prepare
  2. Install Mate Desktop and TigerVNC
  3. Initial VNC Configuration
  4. Configure TigerVNC
  5. Run TigerVNC as a Service
  6. Connect VNC Server Through SSH Tunnel
  7. Download and using VNC clients
  8. Appendix & Troubleshooting

Prerequisites

  • CentOS 7 or Fedora 29
  • Root access privileges

1. System Prepare

Before deploing the VNC server, update your CentOS using the Yellowdog Updater Modified – yum:

The VNC desktop will be available for a non-root user, thus we create a new user and add it to the wheel group for root access.

Add a new user using the following command. Belong we choose the username vncuser he will get this job:

Enter a new password for vncuser.

Now add the user to wheel group able to gain root access.

After all done, login as vncuser and then run sudo su:

Enter the password for vncuser and make sure you elevated root:

2 . Install Mate Desktop and TigerVNC

Linux provide several desktop environments such as Gnome, KDE, LXDE, XFCE and many more. In this guide, we will be using the Mate desktop as VNC desktop workspace. Mate desktop is a lightweight and a continuation of Gnome desktop that is well suited for a server environment.

 Note. you can have more than just one desktop environment on your system.

Before installing the Mate desktop, add the EPEL repository. Now we are ready to deploy the Mate desktop workspace and TigerVNC server by running yum below:

That takes a while, wait until the installation is complete.
The Mate desktop workspace with TigerVNC has been deployed.

3. Initial VNC Configuration

This step will generate the vnc configuration for the vncuser. Login as the vncuser:

Now initiate the vnc configuration for vncuser using the following command:

You’ll be asked for the vnc server password – enter your password, this can by the same or any other.

 For view-only password, you can enable or disable it do hit y or n. The user who logs in to the server using a view-only password will not be able to control the mouse and keyboard.

The first time we run the vncserver, it will automatically create a new configuration directory .vnc during the first vnc startup.

Now you’ll get the first vnc session waked up as shown below:

4. Configure TigerVNC

In here we will configure the VNC server for using the Mate desktop, modify the VNC configuration file xstartup under the .vnc directory.

Before editing the vnc configuration file, stop the first vnc session by run with kill option:

Now backup the default configuration and create a new one by using the editor vim or nano.

Paste the content bolow into the configuration file xstartup:

Make the xstartup script executable and run the vncserver command again:

Next, copy the default Xresources configuration to the vncuser’s home directory:

5. Running TigerVNC as a Service

In this tutorial, we will run the VNC server as a service, for this purpose we need to create a new service file.

SELinux is preventing tigervnc-server from starting, as we notice on fedora, selinux denial prevents daemon from starting, so we run setenforce 0.

Create new service file vncserver@.service to the /etc/systemd/system directory:

Paste the lines into configuration file vncserver@.service below:

Now reload systemd and start the VNC server. Finally we make the VNC service permanently available.

Check using the vncserver command as shown next:

Permit access through the firewall, enter the policy below:

Done!
VNC Server installation and deploying has been completed.

6. Connect VNC Server Through SSH

Finally, we want to encrypt the connection to the VNC server, terminated by an SSH tunnel between both ends.

  Note. this option for encrypted connection, we all love privacy.

Open a terminal by hit ALT + F2 and type in mate-terminal, use the following ssh command as shown next:

The command open up a tunnel between your localhost and the VNC server. The port 5901 on localhost will be forwarded to the VNC server 192.168.69.68 on port 5901.

Now open vnc viewer application and start a new connection, type the VNC server address with the 127.0.0.1 localhost IP and port 5901 as shown below. Please remember, the password is what we have previously entered with vncpasswd

7. Download and using VNC clients

VNC viewer are available even as several free pakages for Linux, Windows and macOS clients.

Using vncviewer on Linux Gnome Desktop, the following command open a VNC session.

Congratulations you made your first VNC session.

Mate desktop on VNC session

VNC clients are collected here and can be visited and downloaded via the links below:

TigerVNC: https://tigervnc.org/
UltraVNC: http://www.uvnc.com/
TightVNC: https://www.tightvnc.com/
RealVNC: https://www.realvnc.com/

8. Appendix & Troubleshooting

Check the vncserver is up and running, use the command below:

In the output you should see Active: active (running)

To detect possible errors or warnings, the X11 server log can be consulted at:

The following ports should be listening on, determine which ports active listening are with this:

For CentOS 7.x and Fedora the command show below:

The output should looks like similary this.

Check the firewall it permit incoming VNC connections:

The output show similary below:

If appears a black screen after successful connect from vncviewer, this cause often at the X11 cache, solve this by shutdown all vncserver instances and reset the X11 server cache, like use the command below:

If the vncserver couldn’t start in case of failed state, cause can be if SELinux is set to enforced, but SELinux blocks the access to such systemd pid file. Modify SELinux to permissive that prints warnings instead of enforcing.