1

I am always getting this crash window when I am using the sudo gedit command:

enter image description here

I wanted to edit the waffle.yaml file for a ROS2 project.

I am facing the same issue for any other file which I am opening using the same command.

I am currently using Ubuntu 22.04 on Oracle VM VirtualBox.

1 Answers1

0

Rather than sudo gedit, set up the EDITOR and VISUAL environment variables in your ~/.bashrc:

export EDITOR=$(type -p gedit)
export VISUAL=$(type -p gedit)

Then, sudoedit waffle.yaml.

sudoedit works like this:

  1. As root, sudoedit makes a temporary copy of the file.
  2. As $USER, sudoedit invokes your editor on the temporary file, avoiding any problems with Graphical editor as root.
  3. As root, if the file was changed, and the editor exited successfully, sudoedit copies the temporary file back.
waltinator
  • 37,856