Remotely Enable Remote Desktop

I work in a lab environment, so most of the windows XP machines i enable remote desktop for easy access. All new machines have remote desktop enabled via group policy.

The GP is located here; (link were appropriate in AD structure)

Computer Configuration, Administrative Templates, Windows Components, Terminal Services, — > Allows users to connect remotely using Terminal Services setting. Enable this.

If you don’t have a domain or don’t have group policy implemented you can still enable remote desktop via the reg command in XP. Here is an example;

Reg Add “\\machinename\hklm\system\currentcontrolset\control\Terminal Server” /v fDenyTSConnections /t REG_DWORD /d 0 /f

Note that this requires admin access to the machine, so you would probably have to authenticate against it first…

net use \\machine /user:domain\user

And last but not least if the firewall is enabled you will also need to add an exception to allow RDP through. Or in my case just disable the firewall completely.

Linux – Installing VirtualBox additions

The following works on CentOs / Fedora / redhat etc… 

Logon to your distro. The packages you need are the kernel-devel.i686, kernel.i686 (if not the latest), and gcc.i386 (complier)

yum -y install kernel.i686 gcc.i386

reboot as the kernel needs to load, then logon again install the kernel dev; 

yum -y install kernel-devel.i686

Now you want to present the virtualbox additions to the cdrom drive on your distro. Click “install additions” on the virtualbox guest console. 

then back on the box mount the cdrom to a directory (make one if you dont have one avail) 

mkdir /mnt/cdrom

mount /dev/cdrom /mnt/cdrom 

Now go to the newly mounted cdrom drive and find the installation;

cd /mnt/cdrom 

Execute the installer, and if all goes well reboot. Services should auto start and sync your time etc. 

./VBoxLinuxAdditions-x86.run

reboot

logon and check your time; 

date

Done.

VMware Server 2.0 – Infrastructure Client

One thing i like about vmware server 2.0, is that you are not forced to use the web console in all cases.

If you are lucky enough to have access to VMware Infrastructure Client 2.5 you can connect via it using the following syntax at the logon screen;

IP address / Name : http://192.168.9.100

If you enter a URL in the host field, use your root and correct password you should be able to logon without issue. Welcome to a nice fast GUI admin console.

Linux – crontab

Time to schedule some tasks!

First you need to make sure your in the /etc/cron.d/cron.allow file. If you are not SU to root and add yourself into it.

Now to create your new crontab file;

crontab -e

You are in vi in your newly created crontab file (note if you do not have access to do this it will say so)

Now, i’m no expert at using vi, but if you press i you will go into insert mode. Do this, then type the cron job details. A typical cron job will look like this

0 4 * * * /export/home/user/backup.sh

so there are five slots before the command you want to run. They are: min, hour, day, month, day-week. So my example above will run at 4am every day. See below for more detail.

once you have entered the line press ESC then type :wq to save and quit.

To confirm the job has been saved successfully in cron type this command;

crontab -l  this will show you your current scheduled tasks, it should output the above job.

In OpenSolaris the crontab files are located at /var/spool/cron/crontabs/ they are named after the specific user. Sometimes its easier to go there than to use vi, but make sure your permissions are all set correctly before editing any system files.

In some distros there are folders like /etc/cron.daily/ which run any scripts inside them on a schedule matching the folder name.

This is a bit more on the format of the 5 timings within the crontab file;

*     *   *   *    *  command to be executed

|     |     |     |     |
|     |     |     |     +—– day of week (0 – 6) (Sunday=0)
|     |     |     +——- month (1 – 12)
|     |     +——— day of month (1 – 31)
|     +———– hour (0 – 23)
+————- min (0 – 59)

Update

@reboot is also another very handy cron modifier. I use the following quite a lot…
@reboot /bin/sleep 600 ; /path/to/your/your_program@reboot /bin/sleep 600 ; /path/to/your/your_program