I am attempting to automount my backup drive on Ubuntu studio 16.04.1.
I type gksu gedit /etc/fstab
in terminal and enter my password, but I cannot see the editor.
Can anyone please help?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityWhen you run gksu
or gksudo
and attempt to run a command that doesn't exist, you don't usually see an error message.
If the gksu
and gksudo
commands are not installed, you do see an error message when you try to run them, but if the program you're trying to run is not installed, you do not always see any error message.
I am able to confirm this by running a command that is not installed (gksu blahblah
) on a Lubuntu 16.04 system where I know the gksu
is installed and working.
The OP was able to solve the problem by checking if gedit
was installed and, upon discovering it was not, installing it.
Besides running gedit
as root with gksu
or gksudo
, another way to edit a system file with a graphical text editor is to use sudoedit
(as waltinator has suggested) but set the VISUAL
environment variable to the editor you want to use:
VISUAL=gedit sudoedit /etc/fstab
EDITOR
instead of VISUAL
also works, provided that VISUAL
is not also set; if VISUAL
is set and not blank, its value takes precedence. VISUAL
doesn't mean "GUI" here.The filename your editor shows you for the file you are editing will be something like fstab.XXEZgT6C
. This is because sudoedit
makes a copy of the file, you edit the copy, and your changes (if any) are written to the file when you close the editor. The filename shown in the editor is the name of the temporary copy.
The editor itself runs as your user, not as root, and has your settings, which can be convenient. However, since the sudoedit
command only completes and writes your changes once you have quit the editor (not just when you've quit the file in the editor but the editor is still open), you'll probably want to either
In some editors, you can change this in the settings.
Of course, your editor does still have to be installed for this to work. But (as with the gksu
/gksudo
way) the editor doesn't have to be Gedit; you can use any editor you like.
gksu
? what DO you see, if not gedit?gedit
wasn't installed, becausegksu
failed silently instead of showing an error. I don't know if gksu never does that or only in some configurations, but it's rather common. This has happened to me many times over the years (well... at least ten times, I'd say), on several different machines with different Ubuntu releases and flavors. I've also seen it vex other users (not just the OP and me). I have posted an answer. I very much hope we reopen this.