Showing posts with label vnc. Show all posts
Showing posts with label vnc. Show all posts

Friday, June 19, 2015

Copying text to and from remote servers

When working with a remote server it is very useful to be able to copy text from the local machine to the remote server or visa-versa. Normally this can be done via the clipboard commands of ctrl-C/ctrl-V. However, this feature sometimes stops working for no clear reason which is very frustrating.

Luckily I have found out that there is a relatively easy way to fix this. There is a program which runs on the remote server that looks after synchronising the contents of the clipboard on the local and remote computers.  The problem is that it sometimes stops working and needs to be restarted.

The VNC protocol is normally used to connect to Linux type systems and in this case the program in question is called vncconfig. It can be restarted by launching a terminal window on the remote system and typing the command:

   killall vncconfig ; vncconfig -nowin &

The RDP protocol is normally used to connect to Windows type servers. In this case the program which does the synchronisation is called rdpclip.exe and the procedure to restart it is only slightly more complex.

Open a command window on the remote system and type taskmgr.exe - the following dialog should appear and you need to click on the processes tab and locate a process with an image named rdpclip.exe. If you have problems spotting it, click on the "Image Name" column header to sort processes by image name. Once you find the process right-click on it and select "end process". This will ask you for confirmation. Once you confirm you can go back to your command prompt and type rdpclip.exe then cut and paste should be working again.




Thursday, August 28, 2014

KDE Remote Desktop Client (KRDC)

I recently switched my work laptop from Ubuntu to RedHat. Since Remmina is not in the default repositories that came with my new client I decided to use KRDC instead.

Overall I must say I am quite impressed with KRDC, it is easy and intutive to use. Its tabbed UI and storing of bookmarked sessions remind me very much of Remmina.

The one problem I have with KRDC is that it refuses to remember the passwords for each of my saved sessions. A dialog comes up prompting for the password with a check-box "remember this password" - I select this check-box but I still get prompted for a password the next time I connect. I assume this is a bug which will be fixed soon, but it is only a minor nuisance (I have a lot of passwords to remember).

A feature from Remmina I miss is the ability to automatically configure sharing between the local and remote machine, but again this is a feature I can live without for now.

Wednesday, May 15, 2013

Seamless sharing between Linux and Windows

I am a big Linux fan, but sometimes my work requires me to work on Windows based machines. To do this I use the Remmina application to allow me to connect my laptop's screen, keyboard and mouse to the remote machine.

The main function of Remmina is to facilitate remote interaction through the VNC protocol for Linux servers and the RDP protocol for Windows servers However another thing that many people struggle with is the need to share files between the local machine and the remote server. This is possible, but can be tricky to set up. For this reason the Remmina dialog for setting up a new connection includes a simple check-box which allows you to specify that you want to share one of your local directories with the remote machine.

When you make this selection Remmina will automatically configure a SMB share for the directory for the directory that you selected. Then it connects to the share on the target machine so you will see a shared drive listed in Windows Explorer on your target Windows machine (see the example screenshot).

I am not aware of any tools for file sharing in the opposite direction (i.e. sharing files between a Windows Laptop and a Linux server). However, I would be very surprised if there were not several tools available to meet this need. Maybe one of the readers of this blog could post a comment with a link to such a tool.

Monday, November 5, 2012

The easy way to configure VNC service on your Linux server

While looking at the access statistics of this blog I noticed that one of the most popular posts is an article I wrote a while ago about how to configure the VNC service on your Linux server. While these instructions continue to work, both RedHat and SUSE have released updates in the meantime which make these instructions partly obsolete.

In REHEL6+ and SLES12+ the configuration screens that come with the operating system include an option to configure what they call remote desktop access. The way the VNC service is configured is slightly different on each Linux variant, but since the  configuration screens allow you to configure the VNC service with a simple point and click UI, you probably don't need to worry about the detail of what happens under the covers.

Of course the instructions I wrote still work so if you followed them and your server is working as desired, there is no need to change. However, it is probably easier and better to use the configuration screens built into the operating system if you have not yet started to configure it. Likewise, if are using an older version of RedHat/SUSE or are using a Linux variant which has not yet integrated VNC configuration into its utilities then feel free to continue using my script.

Saturday, February 4, 2012

Remmina is the best Linux application for working with remote computers

As many people know, I have Ubuntu installed on my work laptop. However, this does not mean the bulk of my development and testing is done on this platform. The software that IBM develops runs on many different platforms and so I need to do most of my work on remote servers which are running various different operating systems.

Ubuntu comes with Vinagre pre-installed - it appears as "Remote Desktop Connect" in the system menu. This tool can connect via the RDP protocol to Windows type systems and it also speaks VNC to most other platforms. While it works, it is not exactly a joy to use so I sometimes use Tsclient to connect to Windows servers and TightVNC to connect to VNC servers. Neither of these tools is perfect either so I decided to look to to see what alternatives are available. After a bit of experimentation I hit upon Remmina as the best overall tool that can be used to connect over either VNC or RDP to remote desktops.

The main features that I like about Remmina are
  • It has a lot of flexibility about resolution. As well as allowing you type in any arbitrary screen resolution you can also ask Remmina to pick a resolution that is optimized to the screen you are using.
  • There are a number of Hot keys that can be used to quickly access common features e.g. change the window size to match the current resolution or visa-versa.
  • It integrates the local and remote clipboard so you can easily copy text from a local application to a remote one.
  • It is easy to get files to or from a Linux machine, but configuring shared drives on windows can be much more tricky. Therefore Remmina helps you by configuring your local home folder (or any other directory you specify) as a shared folder via Samba and then automatically connects to that shared folder from the remote session it establishes on a windows machine.
  • It has a handy applet which integrates with the system tray and allows you to quickly connect to any of your configured servers.
However, Remmina is not perfect. The main problem is the almost total lack of documentation. The project website has the FAQ about where to find documentation "Remmina was designed to be hopefully work for most people without the aid of any documentation". Although this is not really a grammatical sentence it is close to being true, but here are a few things that it would be useful to know before you start using Remmina:

  • Most UI elements in Remmina can also be accessed by a combination of keys on the keyboard. When you hover over a control in the UI with the mouse the equivalent key combination will pop-up.
  • All of the hot key combinations are accessed by first pressing the ctrl key on the right of your keyboard  For example when you hover over the "Full Screen button" in the UI you are told that the keyboard equivalent is "Control_R+F". I initially thought that this meant that I should press the ctrl R and F keys at the same time, but it actually means that you need to press the right hand ctrl button and the F key at the same time.
  • Because the right hand ctrl key is used by Remmina, you will often need to use the left hand ctrl key to use the applications on the remote machine. For example, most editors use the ctrl key combined with the right or left arrows to navigate through the document a word at a time. If you are editing a document in a remote window that you opened via Remmina, you need to use the left ctrl key for this type of navigation because if you use the right crtl key Remmina will interpret your ctrl arrow key presses as instructions to switch to a different active remote connection.

Saturday, November 5, 2011

Automatically starting the VNC server at boot time on your Linux virtual machines

[Note: check this update before following these instructions]

These days, many people in IBM (and I am sure many other companies) are using Linux virtual machines for their normal work. The hard core geeks are happy to connect to their virtual machines via ssh and do all of their work on the command line. However, the rest of use appreciate the convenience of a graphical interface and so like to use VNC. Unfortunately, the default configuration is that the VNC server does not automatically start every time you reboot. If you reboot your server regularly, it can be a pain to continually have to log into the server and start VNC.

After a bit of digging I found this excellent blog post which describes how to auto-start the VNC server on Ubuntu.  However, most people I know tend to install Ubuntu on their laptop (which doesn't really need VNC server to be running) and use either SUSE or RedHat on their real servers. I had to make a few minor tweaks to get the script working on these Linux variants. The script below works on SUSE and RedHat variants of Linux. I have tested it on SLES 11 and RHEL5.6 - it should work on pretty much any Linux variant, but I would love to hear feedback from people if there are any issues.

As described in andrew's blog, it is necessary to start VNC manually the first time so that you can enter the security password. The first time you launch the program will create a default ~/.vnc/xstartup script which you can customize to meet your preferences. You should download the script to /etc/init.d/vncserver (making sure that the script is executable with the command "chmod +x /etc/init.d/vncserver") and then use the command "chkconfig vncserver on" to configure the server to start at boot time.

The bulk of the script is identical to Andrew's so you can read his description of how it works. I highlighted in red the places where I needed to alter it:
  1. The original script declared a dependency on the networking service, but this service is called network on other Linux variants. Changing the dependency to $network allows the script to be more portable.
  2. At the start of the script you can see some specially formatted comments which are interpreted as directives by the chkconfig command. There are several variants of this command and most systems do not have detailed documentation on what directives are used. The Debian wiki seems to have a complete list of possible directives. You don't need to worry about putting in special directives which are not understood by your variant of chkconfig because they will simply be treated as normal comments. The original script has enough directives to keep Ubuntu happy, but SUSE seems to insist on a "Required-Stop:" directive and RedHat seems to insist on the service description being included.
  3. The original script used log_action_begin_msg, but this seems to be a command only supported on Debian derivatives so I changed them to simple echo commands.
#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          vncserver
# Required-Start:    $network
# Default-Start:     3 4 5
# Default-Stop:      0 6
# Required-Stop:
# Short-Description: Starts and stops VNC server
# Description: Starts and stops VNC server
### END INIT INFO
PATH="$PATH:/usr/X11R6/bin/"

# The Username:Group that will run VNC
export USER="root"
#${RUNAS}

# The display that VNC will use
DISPLAY="1"

# Color depth (between 8 and 32)
DEPTH="16"

# The Desktop geometry to use.
#GEOMETRY="x"
#GEOMETRY="800x600"
GEOMETRY="1024x768"
#GEOMETRY="1280x1024"

# The name that the VNC Desktop will have.
NAME="my-vnc-server"

OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"

. /lib/lsb/init-functions

case "$1" in
start)
echo "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;

stop)
echo "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;

restart)
$0 stop
$0 start
;;
esac

exit 0