1. Installation

Create vmware user account:

useradd -u 500 winsrv
passwd winsrv<

Download VmWare player< or workstation<. Install as root:

rpm -Uvh vmware-*.rpm
vmware-config.pl<

Network settings (should be in accordance with IP-filters<):

  • /dev/vmnet1 - HostOnly - 172.16.113.1/255.255.255.0
  • /dev/vmnet0 - bridged - eth0 (212.x.x.x)
  • /dev/vmnet2 - bridged - eth1 (172.16.112.1)
  • /dev/vmnet8 - NAT - 172.16.114.1/255.255.255.0

After that VmWare will be run from the winadmin account.

VmWare virtual machine root folder is: /var/vmware/winadmin/winsrv.

Here we create Windows disk of 32Gb.

Also we create subdirectory /var/vmware/winsrv/shared-folders, enable Shared Folders by default in the virtual machine settingsand connect this subdirectory under the name shared-folders. In the Windows explorer surf to

\\.host\Shared Folders\shared-folders<

mount Shared Folders as disk S: and create desktop icon. The next step is to automatically run VmWare under VNC.

2. Control via VMrun

2.1. Xvnc for VmWare

We are going to control Windows console remotely without usingvendor tools. The simplest solution is to run VmWare in a VNCserver and connect to VNC remotely using a VNC client.

Setting up VNC server for VmWare:

  • log in as root:
    • install the vnc-server-4.0-11.el4 package
    • edit /etc/sysconfig/vncservers:
VNCSERVERS="99:winadmin"
VNCSERVERARGS[99]="-geometry 1152x864 -depth 16"<
  • log in as winadmin:
    • edit /var/vmware/winadmin/.vnc/xstartup:
#!/bin/sh
#unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
#vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
metacity &
#gnome-panel --sm-disable &
#twm &<
    • setup the VNC server access password:
$ vncpasswd
Password: winsrv<
  • log in as root:
    • make the VNC run on boot
chkconfig vncservers on
service vncservers start<

2.2. Control script (RHEL)

Install the Windows control script /etc/init.d/winadmin< and desktop entry /usr/share/desktop/windows-console.desktop<:

chmod +x /etc/init.d/winadmin
chkconfig --add winadmin<

Script usage examples:

service winadmin start
service winadmin stop [nowait]
service winadmin status
service winadmin console<

3. Control via SSH

Install SSH in Windows as described here<. Configure password-less login for winadmin in Windows:

ssh-keygen -t rsa
...
scp .ssh/id_rsa.pub [email protected]:
Password: ...
ssh [email protected]
Password: ...<

Log in Windows as winadmin and:

ssh-user-config
...
cat id_rsa.pub >> .ssh/authorized_keys
rm id_rsa.pub
exit<

Configure batch login for winadmin with timeout:

touch .ssh/config
chmod 600 .ssh/config
vi .ssh/config<
Host winbatch
HostName win.ourdom.com
HostKeyAlias winbatch.key
User winadmin
ConnectTimeout 2
BatchMode no<
ssh winbatch
подтверждаем ключ хоста
exit
vi .ssh/config<
BatchMode yes<

Вложения