I think you are asking how you can edit a file which is owned by user 'root' or some other user that you don't have privilege to edit. Right?
If that's what you need to do, and you know the superuser (root) password, you can use the su command to temporarily become root. You'll be prompted for the password for root. Be careful. You'll have awesome power until you execute exit to return to mere mortal status.
Alternately, if the /etc/sudoers file is configured correctly (as it always is on Ubuntu), you can use the sudo command on each command. You'll be prompted for your own password, (not root's). Naturally, you can use whatever editor is installed: emacs, vi, vim, nano, joe, nedit, etc. e.g.:
sudo nano filename
|