Edit a file with admin privileges
Editing files with administrator privileges is potentially dangerous, and may break your system in bad ways. Take great care.
The instructions below assume that Linux is used.
If the file needs to be created
First, if the file doesn't exist yet, it needs to be created beforehand.
Open a terminal and execute a command like:
sudo touch /path_to_file
Replace /path_to_file with the desired path.
Example:
sudo touch /root/gedit-test
Open an existing file
To edit an existing text file with gedit with admin privileges, open a terminal and execute a command like:
gedit admin:///path_to_file
Replace /path_to_file with the desired path.
To continue the example from the previous section:
gedit admin:///root/gedit-test
You will need to successfully enter the administrator password in order to open the file.
The gedit command needs to be executed as a normal, unprivileged user.