Saturday, 14 July 2012

Linux : VNC - Virtual Network Computing

Objective: To create VNC server and make this accessible for the remote client.

Virtual Network Computing (VNC) is a graphical desktop sharing system.
VNC is platform-independent -a VNC viewer on one operating system may connect to a VNC server on the same or any other operating system.

Environment: Redhat Linux 5.0 32-bit.

1. VNC server
Hostname: server
IP address:

2. Remote user
IP address:

- Install and verify "vnc" packages.
- Create your VNC users.
- Set your users' VNC passwords.
- Edit the server configuration.
- Create and customize xstartup scripts.
- Start the VNC service.
- Test VNC user.

1. Verify install both the packges of VNC server.
[root@server ~]# rpm -qa vnc*

Install VNC server and client package.
[root@server ~]# yum install -y vnc*

[root@server ~]# yum list vnc*
Installed Packages
vnc.i386                                 4.1.2-9.el5            installed
vnc-server.i386                       4.1.2-9.el5            installed

2. Create VNC user.
[root@server ~]# useradd sunlnx
[root@server ~]# passwd sunlnx

3. Edit VNC server configurations.
Append the below lines in config file(/etc/sysconfig/vncservers)
VNCSERVERARGS[1]="-geometry 640x480"

[root@server ~]# tail -2 /etc/sysconfig/vncservers
VNCSERVERARGS[1]="-geometry 640x480"

4. Need to create default startup scripts.
[root@server ~]# vncserver

You will require a password to access your desktops.


New 'server:1 (root)' desktop is server:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/server:1.log

This would have created .vnc directory in $HOME.
[root@server ~]# ls -ld .vnc/
drwxr-xr-x 2 root root 4096 Jul 14 13:40 .vnc/

[root@server ~]# ls .vnc/
passwd  server:1.log  xstartup

5. Create xstartup scripts.
We will create the xstartup scripts by starting and stopping the vncserver as root.
[root@server ~]# service vncserver start
Starting VNC server: 1:sunlnx
New 'server:1 (sunlnx)' desktop is server:1

Starting applications specified in /home/sunlnx/.vnc/xstartup
Log file is /home/sunlnx/.vnc/server:1.log

                                                           [  OK  ]
[root@server ~]# service vncserver stop
Shutting down VNC server: 1:sunlnx                         [  OK  ]
[root@server ~]#

6. VNC server listens on port 5901.
[root@server ~]# netstat -nalt
tcp        0      0      *                   LISTEN

7. Install "vncviewer" on the remoted system, and connect to the VNC server.
Below are the snaps.

Objective successful.

Saturday, 7 July 2012

Linux talk - talk to another user

I came across talking to same users(/etc/passwd)in the local server. The same could be used to even talk to the users remotely.

To talk to the user who is logged in more than once, use ttyname to indicate the appropriate terminal name.Once communication has been established, the two parties may type simultaneously.

Let's see how can we configuire this.

1. Verify the package is installed, if not install by 'yum' or 'rpm'.
[root@server ~]# rpm -qa | grep talk
[root@server ~]#

2. Change Disable=no in talk file.
[root@server ~]# vi /etc/xinetd.d/talk
# default: off
# description: The talk server accepts talk requests for chatting with users \
#       on other systems.
service talk
        flags                   = IPv4
        disable                 = no
        socket_type             = dgram
        wait                    = yes
        user                    = nobody
        group                   = tty
        server                  = /usr/sbin/in.talkd

3. Make sure both 'talk' and 'ntalk' are 'on'
[root@server ~]# chkconfig --list | grep talk
        ntalk:          on
        talk:            on

4. Restart 'xinetd' service to take effect.
[root@server ~]# service xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                            [  OK  ]

Case 1:
I shall communicate to different user(login names)on the same server. 

[root@server ~]# grep "^root" /etc/passwd

[root@server ~]# grep "sysadm" /etc/passwd

Case 2:
Talk to a user who is logged in more than once.Here, you need to communicate with their terminal name.

[root@server ~]# tty

[sysadm@server ~]$ tty

Enjoy CLI in your work environment.