Getting root privileges by software in C

I want to mount a CDROM by software. rbr ( an linux expert ) explain how to do this by software using the mount command but I see in the man page that I must be root. I do not want to be root when running my prog, I want to be an user so my question is : how can I get root permission to mount filesystem, access to the input/output ports using inp, out ...?
daanenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ResonanceCommented:
You cannot gain root permissions from inside a program that is not either run as root or setuid root.  However, you can make your cdrom mountable by users by placing it in /etc/fstab

Adding the following line (it's all on one line, so be careful if you see it wrapped) to /etc/fstab will make /dev/cdrom mountable by all users, but will not automount on boot.

/dev/cdrom      /cdrom  iso9660 user,noauto,ro
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.