I am trying to edit `tomcat-users.xml` in Tomcat 8, using the terminal of CentOS 7 Linux. I typed `su -`  to use the terminal as the `root` account.

I then typed in `vi $CATALINA_HOME/conf/tomcat-users.xml`, but the result is that `vi` opens in the window with the contents of `tomcat-users.xml` in read-only mode, and there seems to be no way out of `vi` except to close the window, losing all the terminal history.

I also navigated to the physical location of `tomcat-users.xml` and opened up the file using Gedit, but Gedit will not allow me to save the file. How can I edit `tomcat-users.xml`?