You should generally always use gksudo (on Cinnamon/MATE/Xfce) or kdesudo (on KDE) for running graphical programs as root. Use sudo and su only for command line programs. Otherwise you may end up with the graphical programs changing ownership of files in your home directory to root, which can cause lots of issues.
gksudo, kdesudo, and sudo are authorized with your own password and you need to be a member of the sudo group to be able to use them. su requires you to authorize with the password of the user you're changing to and you don't need to be a member of the sudo group to be able to use it. For gksudo and kdesudo you get a graphical window to type your password in. For sudo and su you type the password on the terminal (which doesn't give you any visual feedback as you type it).
Summary of differences between these commands:
gksudo
andkdesudo
set $HOME to the home directory of root, and set $XAUTHORITY to a new file outside your home directory (though with the same cookie for communicating with the X server), so the program you run doesn't change ownership of files in your home directory to root. Only a limited number of environment variables, and no functions or aliases, are preserved when changing user this way.sudo
does neither of those and thus should generally not be used for graphical programs as these use those environment variables. Only a limited number of environment variables, and no functions or aliases, are preserved when changing user this way.
sudo -i
does set $HOME to the home directory of root, and also changes to that directory, but as it doesn't set $XAUTHORITY should still not be used for graphical programs. Only a limited number of environment variables, and no functions or aliases, are preserved when changing user this way.sudo -H
does set $HOME to the home directory of root but as it doesn't set $XAUTHORITY should still not be used for graphical programs. Only a limited number of environment variables, and no functions or aliases, are preserved when changing user this way.
su
does set $HOME to the home directory of root but as it doesn't set $XAUTHORITY should still not be used for graphical programs. All environment variables (with a few changes), but no functions or aliases, are preserved when changing user this way.
su -
does the same thing assudo -i
(but you authorize su with root's password and sudo with your own).