During penetration testing if you gain access to shell probably it will be user with not root privileges. To find correct exploit that will increase your privileges (give you root), you have to learn what you have on target machine.
uname -r
2.6.24-24-server
uname -mrs
Linux 2.6.24-24-server i686
lsb_release -a
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 8.04.3 LTS Release: 8.04 Codename: hardy
cat /etc/*-release
DISTRIB_ID=Ubuntu DISTRIB_RELEASE=8.04 DISTRIB_CODENAME=hardy DISTRIB_DESCRIPTION="Ubuntu 8.04.3 LTS"
cat /proc/version
Linux version 2.6.24-24-server (buildd@palmer) (gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu4)) #1 SMP Tue Jul 7 20:21:17 UTC 2009