Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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 .

share|improve this answer
    
@hakermania I agree with you but he asked for an example.So I did mention that. –  raaz Aug 21 '13 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? –  Python Student Aug 21 '13 at 14:30
    
Accepted the Edits , Thank you for your work. –  raaz Aug 21 '13 at 14:30
    
I'm guessing deluge is calling a script which then runs the gui (since deluge has a separate daemon thread). –  Python Student Aug 21 '13 at 14:35
2  
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 Aug 21 '13 at 15:02
show 6 more comments

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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