1

I want to remove Disk Utility from my Ubuntu computer. How can I remove it?

For security reasons, I want to hide that utility from others. How can I hide it, then unhide it again?

5
  • Why do you need it?
    – Pilot6
    Jun 11 '15 at 19:47
  • @Pilot6 for security. and I want to hide that utility from others. Jun 11 '15 at 19:49
  • @MadhavNikam what are your requirements ? As it has been already mentioned, removing this utility, will remove the desktop. If we're talking about changing permissions on who can run the utility, sudo user can still change them. Are your users sudo or non sudo ? Please give us more info. Jun 11 '15 at 20:10
  • @Serg I edit question.. I got some very good answers and info.. I make broad my question. Jun 11 '15 at 20:14
  • I am so happy both answers are very usefull and perfect for my reqirement. Jun 11 '15 at 20:24
2

There is no way to remove gnome-disk-utility form Ubuntu without removing desktop environment.

This utility requires sudo password to perform any dangerous tasks.

You can hide it by removing .desktop shortcut from /usr/share/applications

The correct way to prevent users from dangerous actions is not to give them administrative rights. You can create an ordinary user by

System Settings -> Users & Groups

and let people you do not trust login only with that account.

There is also a workaround, but this is a bad practice.

sudo mv /usr/share/applications/gnome-disks.desktop /usr/share/applications/gnome-disks.desktop.bak

This will remove shortcut from unity panel and programs menu.

To revert it back run

sudo mv /usr/share/applications/gnome-disks.desktop.bak /usr/share/applications/gnome-disks.desktop
11
  • And any user can start it via the command line. Nice answer.
    – A.B.
    Jun 11 '15 at 19:52
  • sudo user will always be able to start it. But the question was how to hide it from people who do not probably know how to use command prompt.
    – Pilot6
    Jun 11 '15 at 19:54
  • 2
    @Pilot6 I suggest instead of rm do mv , gnome-disks.desktop to gnome-disks.desktop.bak Jun 11 '15 at 20:06
  • 1
    But if do not make a backup, the package can always be reinstalled. And the .desktop will be restored.
    – Pilot6
    Jun 11 '15 at 20:15
  • 1
    The mv command moves the file from the first specifed location to the second (in the case the file that makes the thing appear in the menu), a version using rm removes the specified files. You can restrict sudo user to certain commands (using command aliases so the user can only do some things). Also, everyone note there are loads of disk utilities, like gparted, parted, fdisk... all require sudo permission though
    – Wilf
    Jun 11 '15 at 20:22
1

If the other users do not have sudo priviliges, sudo chmod 700 $(which gnome-disks) && sudo mv /usr/share/applications/gnome-disks.desktop /usr/share/applications/gnome-disks.desktop.bak are sufficient

This line of commands changes permissions to only available to root and hides application from appearing in the search launcher. To undo everything, run sudo sh -c 'chmod 755 /usr/bin/gnome-disks && mv /usr/share/applications/gnome-disks.desktop.bak /usr/share/applications/gnome-disks.desktop

Hiding any file in linux can also be done my adding a leading dot to filename, like so: sudo mv /usr/bin/gnome-disks /usr/bin/.gnome-disks. You can do the same with the .desktop file. Undoing the effects is merely using mv command with the addresses swapped

6
  • If they can find gnome-disks, they will find it either way. But it is very unlikely.
    – Pilot6
    Jun 11 '15 at 20:27
  • @Serg Undo command not work.. and terminal shows > > no error nothing do anything. Jun 11 '15 at 20:33
  • @MadhavNikam ah, so the $(which gnome-disks) wont work if you've changed the permissions. You'd have to give full path. I'll edit my answer in a second Jun 11 '15 at 20:37
  • @Serg sudo sh -c 'chmod 755 /usr/bin/gnome-disks && mv /usr/share/applications/gnome-disks.desktop.bak /usr/share/applications/gnome-disks.desktop this not produce output? > Jun 11 '15 at 20:52
  • 1
    @MAdhavNikam yes, this operation does not show anything in console. If you have done the first command sudo chmod 700 $(which gnome-disks) && sudo mv /usr/share/applications/gnome-disks.desktop /usr/share/applications/gnome-disks.desktop.bak This hides the disk utility from others, except root user. After you run ` sudo sh -c 'chmod 755 /usr/bin/gnome-disks && mv /usr/share/applications/gnome-disks.desktop.bak /usr/share/applications/gnome-disks.desktop ` this should be quiet, but gnome-disks should now be available again. Jun 11 '15 at 20:56
1

This program can be easily removed. The desktop environment is NOT removed.


Disks or better /usr/bin/gnome-disks is part of the package gnome-disk-utility.

% which gnome-disks 
/usr/bin/gnome-disks
% apt-file search /usr/bin/gnome-disks
gnome-disk-utility: /usr/bin/gnome-disks

Therefore

sudo apt-get remove gnome-disk-utility

If you need the tool again:

sudo apt-get install gnome-disk-utility

Explanations:

Here is the output of the remove command:

% sudo apt-get remove gnome-disk-utility
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  gnome-disk-utility ubuntu-gnome-desktop
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 6.619 kB disk space will be freed.
Do you want to continue? [Y/n]

ubuntu-gnome-desktop and all other *-desktop are only meta packages. These can be removed without problems.:

% apt-cache rdepends gnome-disk-utility
gnome-disk-utility
Reverse Depends:
  gnome-disk-utility:i386
  gnome-disk-utility:i386
  gnome-disk-utility:i386
  ubuntukylin-desktop
  ubuntu-gnome-desktop
  lubuntu-desktop
  gnome-core
  ubuntu-desktop
9
  • This will remove ubuntu-desktop.
    – Pilot6
    Jun 11 '15 at 19:50
  • @Pilot6 And anyway, gnome-desktop is a meta package.
    – A.B.
    Jun 11 '15 at 19:51
  • @A.B. Littele curiocity in mind... can it applicable for other utility also? Jun 11 '15 at 20:05
  • @MadhavNikam That depends on what programs you mean. The procedure should not be generalized.
    – A.B.
    Jun 11 '15 at 20:06
  • 1
    Tested this answer. Works. Ubuntu deskto still intact. Good answer AB ! Upvoted Jun 11 '15 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.