I need to load modules to connect to the internet, so I've created a script.

Script file is called 'connect.sh' is owned by root and has permissions set to 4755, so it is executed as root, even if run by non-root user (at least I think so). I still get errors:

When script comes to line '/sbin/modprobe pppoatm' it gives:
WARNING: Error inserting slhc (/lib/modules/ Operation not permitted
WARNING: Error inserting ppp_generic (/lib/modules/ Operation not permitted
FATAL: Error inserting pppoatm (/lib/modules/ Operation not permitted

Any idea?

PS: I really would like to avoid changing any other files than the script file 'connect.sh' if possible...

Funnily enough, just last week I wrote a little howto on this (see my website in my signature for more info). The reason for the problem you're experiencing is that while most *nix distributions work fine when the setuid bit on a binary is turned on, the distributions specifically disable the use of setuid bits on shell scripts, due to their insecure nature.

There are two possible workarounds: a) edit the sudoers file so that sudo doesn't require a password for the commands that you need to execute in your shell script, or b) call the script from a C program using the system() call.

Thank you very much for your help! I will check if it works later, but I think it will. Thanks!