Saturday, March 7, 2015

Step By Step Guide To Root Access Via SSH On UCCX 10.6

We will do this by booting the VM with a Redhat Centos ISO image. Then we are modifying some parameters and will end up after one reboot with a rooted UCCX system. This guide is also valid for CUCM / CUPS / UCXN. Supported version for this to work is at least 9.x to 10.x. I guess 8.6 should work also.

This guide will walk you through the rooting process of an UCCX 10.6 system. With the 10.x release Cisco switched from a 32bit Linux to a 64bit Linux. So, when you are on a pre 10.x system, you need a 32bit version of Centos. If you are at least on version 10.x you need the 64 bit version.

I use these:

Things needed for the rooting process of UCCX 10.6:
  • Running Cisco UCCX 10.6 System
  • CentOS-6.6-x86_64-bin-DVD1.iso or equivalent.
  • 15-30 min of time to spend on this

I'm showing this  on a Vmware workstation 7.1 host. Other Vmware versions might/will show a different menu. If you are going to do this, you will be able to figure out where to find the relevant checkboxes. ;-)

I suggest taking a snapshot of the system before we begin.

We start by  open the settings window of our UCCX machine. There we map our DVD drive to the Centos ISO image. Check that it will connect on power on.

Then we open the VMX file of your UCCX machine and enter an additional line:

bios.bootDelay = "7000"

When we start the UCCX system, this will give us a 7 sec delay to press ESC in the boot process.Which brings us to the boot menu:

Select "CD-ROM Drive" and press enter.

Select "Rescue installed system".

Select "English".

I prefer to leave it at "us". If you are using a non us keyboard this might be a little bit awkward if you are not used to this.

No need for a network here.

Select "Continue".

This can be a little bit tricky. Choose your active partition. Easy guess here because I came from 9.02 (ver5) to 10.6 (ver6). So it has to be the sda1 partition.

Select "OK".

Select "OK".

Select "Shell".

If you get an error reporting that /mnt/sysimage was mounted read only, you can fix it with:

mount -o rw,remount /mnt/sysimage

After checking /mnt/sysimage is mounted as rw you change your root to the mounted, hopefully active, partition:

bash-4.1# chroot /mnt/sysimage

Now we can start editing the systems config for root access via SSH.

Remove securetty to get rid of TTY restrictions:
sh-4.1# rm /etc/securetty

Set a password for root. Because this is only a lab system you can use a simple password and ignore the warning.
sh-4.1# passwd root
Changing password for user root.
New password:
BAD PASSWORD: it is too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.

Assign a shell to the root user:
sh-4.1# vim /etc/passwd
Replace “root:x:0:0:root:/root:/sbin/nologin” with “root:x:0:0:root:/root:/bin/bash”.

Quit and save.

Allow root login via SSH:
sh-4.1# vim /etc/ssh/sshd_config
Add the line “PermitRootLogin yes”.
This one is write protected. So quit by using :wq!.

Set Selinux to permissive:
sh-4.1# vim /etc/selinux/config
Replace “SELINUX=enforcing” with “SELINUX=permissive”.
Quit and save.

Reboot the system to verify successful root access.
sh-4.1# reboot

When the reboot is finished try to ssh to the UCCX system. You should be prompted with this:

login as: root
root@'s password:
Send automatic password
Last login: Fri Mar  6 19:56:49 2015 from
[root@LABUCCX ~]#

There we are. Success! This is intended only for use in lab environments! Don't use this in production environments.

For those not familiar with the VIM editor there are some good tutorials online. This one has the important stuff covered:

In short words:
/FindMe        Search for pattern FindMe. Caution! This is case sensitive.
    n          Next hit
    N          Previous hit
To edit a file press i. This will bring you to the insert mode. Now you can insert and delete text.
When you are done press ESC to leave insert mode.
:q!            To quit without saving. You loose changes made.
:wq            To save and close the file.
:wq!           To save and close the file. Even if it is flagged as read only.


Mike O said...

I get an error message about not being able to /mnt/sysimage I tried to use this command: mount --bind /dev /mnt/sysimage then chroot /mnt/sysimage but it mounts it as read-only.

Any ideas?

cflux said...

Sorry, didn't see this earlier. I updated the guide to fix this problem.