How Do I Load A Program With Superuser Permission?

Asked by taurus

I installed a program called 'moto4lin'. The only way for me to load it up is by using 'gksudo moto4lin'. I added the program to my menu and gave it the above command to open it. However, it asks for my password all the time when I load it up. Is there a command I can give it so it loads up without asking me for my password? This would be convenient.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu sudo Edit question
Assignee:
No assignee Edit question
Solved by:
taurus
Solved:
Last query:
Last reply:
Revision history for this message
Thomas Kluyver (takluyver) said :
#1

Hi

There isn't--the password dialog is a deliberate security feature. When you start a program with superuser permission, it can do anything it wants to your computer. So the password is both a check that it's still you running that program, and a warning that you could damage your computer.

I think it does last about 15 minutes without needing your password again, but there's definitely no way to turn it off. What does the program do? Most programs should be able to run, most of the time, without superuser permissions.

Revision history for this message
Bhavani Shankar (bhavi) said :
#2

I think you can do that in /etc/sudoers by changing the group owned to have root previlages (but thats not recommended due to security reasons)

anyways have a look at

man sudoers

Regards

Revision history for this message
taurus (taurusxz) said :
#3

Hi, thomas K. To answer your question, I can run this program as a normal user, but it won't allow me to make changes. However, when I load it up with sudo, I'm then able to make the needed changes. That's just the way it is, unfortunately. It's no skin off my back, but I'd love to have this program load up without me to have to provide my password.

This is why I wish there was a command to allow to load this program up that includes a password.

Revision history for this message
Bhavani Shankar (bhavi) said :
#4

From the console run

sudo visudo

Despite the name it'll probable use nano as the editor.

At then end of this file append a line

yourusername ALL=NOPASSWD:/path/to/your/command

Save the file (ctrl-x in nano), start a new console and try your command

sudo /path/to/your/command

You shouldn't be prompted for a password.

Or

If you want to make it as root permanatly

sudo chmod 4755 file

(sudo chmod 4755 -R directory ; In case its a directory)

That would make it so that when the file is run it runs as a process controlled by the root user.

Regards

Revision history for this message
taurus (taurusxz) said :
#5

Hi, bhavani, thanks for the reply. When I open visudo through nano, I get a blank terminal with no code in it, although there's a guide at the bottom for shortcuts like, exiting, etc. Is this normal? Also, according to your instructions, you say to append with 'sudo /path/to/your/command'.... does '/path/to/your/command' mean, 'sudo moto4lin' or does it mean path to the program? Please clarify.

Also, 'sudo chmod 4755 moto4lin' does not work because again, it asks for my password.

Revision history for this message
Bhavani Shankar (bhavi) said :
#6

make sure you make the path of the program while chmod 4755

example

sudo chmod 4755 -R /home/bhavi/music

makes the musi directory owned by root user

secondly

you will append that line to /etc/sudoers

as an example look at this

http://snippets.dzone.com/posts/show/838

and to edit /etc/sudoers

gksudo gedit /etc/sudoers

is an alternate way

Regards

Revision history for this message
taurus (taurusxz) said :
#7

Hi, Bhavani. I used your tip for 'moto4lin'. However, when I tried to apply your same instructions to load 'synaptic' and 'sysv-rc-conf', it asked me for my password. The folllowing codes is what I entered in /etc/sudoers to no avail. What must I do now?

x ALL=(ALL) ALL, NOPASSWD: /usr/sbin/synaptic

x ALL=(ALL) ALL, NOPASSWD: /usr/sbin/sysv-rc-conf

Revision history for this message
Bhavani Shankar (bhavi) said :
#8

whats your username?

Revision history for this message
Andreas Troschka (signupbox) said :
#9

Despite the claimed question's title, what you are asking for now is to have root privileges all the time.
This isn't the concept on which Linux is based.
Superuser access' are there to do system maintenance, no less, no more.

Your operating system has been setup to give access to its sensible parts to whom having the necessary knowledge and willing to *harmful* work on the deep aspects of the o.s..

This to prevent viruses, malware, spyware, badware, bogusware... and simple programming errors to compromise the installation as often happens on another o.s., constricting its users to make the installation and administration of various supposed to be antisomething software the main everyday job on their computers (after paying for them).

Anyway, to give no way to antiLinuxer's guys to say you will not receive the help you request from the Linux community, here the answer to the question you have not officially asked for:
you have a chance to transform your Linux installation to a W.....s clone exposing it to any possible risk by reactivating the root account and by logging-in as the latter.

;-)

Good luck.

Revision history for this message
taurus (taurusxz) said :
#10

Andreas, thanks for the reponse. Do keep in mind Bhavani's reply where he recommends a site that details the procedure for opening synaptic without a password. Let me know what you think. The site is:

http://snippets.dzone.com/posts/show/838

And to answer your question, Bhavani, my username is 'x'. It's the first letter to the codes I gave above.

.

Revision history for this message
Jim Hutchinson (jphutch) said :
#11

That would not be a good idea. These are security features and disabling them is the first step toward breaking your install. It isn't that hard to type the password and it's a good reminder that you are doing something that could damage the system. If your password is long and complex because you want a secure set up then not having to type it would save time but it also undermines your reasons for choosing a long password. If it's short then it's not a big deal.

Not to be blunt or anything, but if you have to ask how to make changes like this then you probably shouldn't be making the change.

Revision history for this message
taurus (taurusxz) said :
#12

Hi, Jim, Thanks for the reply. I understand where you're coming from. However, don't you think an exception can be made when it comes to synaptic? The following site fetails how to load synaptic without a password, so it sounds liike it's safe enough:

http://snippets.dzone.com/posts/show/838

Do you think that my entire system can become compromised from just enabling synatpic to load without a password? It's just one program that I want to do this to.

Revision history for this message
Jim Hutchinson (jphutch) said :
#13

Well, Synaptic isn't just any program - it is one of the most central and powerful programs controlling the essence of your system. Do I think your system can be compromised? Probably not. However, when it comes to system stability we are our own worst enemies. I've never had my system compromised but I've messed up stuff myself plenty of times. I think what you are proposing is one step closer to such problems. However, it's your system so you can do as you please. I personally wouldn't recommend it but then the choice is up to you.

Revision history for this message
taurus (taurusxz) said :
#14

Jim, after giving thought upon what you said, you're right. I'll leave synaptic alone. Thanks, dude!