2

For instance, if I needed to lock firefox, and whenever someone needs to access it (under the same username as mine) the usual sudo password prompt should appear. I have disabled password prompt by default under visudo by giving my username 'nopasswd' privilege.

2 Answers 2

1

Generally, the owner of the applications in Ubuntu is root. For example check the applications from /usr/bin. You can check this with ls -l /usr/bin. For Firefox Web Browser, the result is:

ls -l /usr/bin/firefox
lrwxrwxrwx 1 root root 25 aug  3 23:37 /usr/bin/firefox -> ../lib/firefox/firefox.sh

So, to lock Firefox for other users than root, you need to take out the execute permission for group and others. You can do this with the following command:

sudo chmod 766 /usr/bin/firefox

or

sudo chmod go-x /usr/bin/firefox

lock firefox

0
-1

as you have mentioned in your question that , if you want to lock an application that could be accessed by only root means , just change the permissions.

sudo chown root:root /usr/bin/firefox
sudo chmod 700 /usr/bin/firefox

for example I made it for pidgin:

jai@frank-Jai:~$ sudo chown root:root /usr/bin/pidgin
[sudo] password for jai: $$$$$$
jai@frank-Jai:~$ sudo chmod 700 /usr/bin/pidgin
jai@frank-Jai:~$ pidgin
 bash: /usr/bin/pidgin: Permission denied

jai@frank-Jai:~$ 

next time onwards if you would like to open firefox means type as

sudo firefox

Please note that in some rare cases (but it is something that is true for e.g. Firefox and Chromium), when a command is called, there is a script that is called first and then it is the one that launches the "normal" program executable. If you disable the script from running you will prevent anyone from running the application normally (e.g. from shortcuts or commands e.g. firefox). If someone knows where the "normal" executable of that application is located, then he will be able to launch it without any problem through a terminal. In order to avoid this, you have to change the permissions of that executable as well. Firefox's executable is located at /usr/lib/firefox/firefox.

For Deluge as OP mentioned :

Deluge Consists of Deluge and Deluge-gtk . so you have to do that for both .

11
  • @hakermania I agree with you but he asked for an example.So I did mention that.
    – Raja G
    Commented Aug 21, 2013 at 14:22
  • I tried the above and it worked, well...for firefox. Then I tried it with compiz-config and deluge and ubuntu tweak. unfortunately deluge is still accessible from the launcher! Yet from a terminal, it says "permission denied". why's this happeing I wonder? Commented Aug 21, 2013 at 14:30
  • I'm guessing deluge is calling a script which then runs the gui (since deluge has a separate daemon thread). Commented Aug 21, 2013 at 14:35
  • 1
    @PythonStudent . If you want to reverse it again then all you need to change the owner of the application file. Better than me this link can explain. help.ubuntu.com/community/FilePermissions
    – Raja G
    Commented Aug 21, 2013 at 14:44
  • 3
    This answer should include some kind of warning that running internet facing applications like firefox or pidgin is a terrible idea. This grants easy root privileges to hackers via Cross Stie Scripting for example.
    – user68186
    Commented Aug 21, 2013 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .