Jump to content

Granting root without asking for password


Recommended Posts

Hello all,

I am running Arch Linux with Wicd managing my wireless connections. At system startup it requires me to enter my password to get it to start up properly with access to the wireless interfaces, this can be a pain, especially when I incorrectly enter my password, and I have to manually start Wicd. This is in no way a necessity, but something that would make my life easier, and something that would be good to know in the future, as I can see different things that this could be useful for. My question is: Is there any way to permanently give root access to a program without it being reset at reboot. I think doing a chmod might work, but I am unsure.

Thank you in advance,


Link to comment
Share on other sites

You need it to be owned by root, world or group executable, and have the setuid bit set. To do this:

chown root:group /path/to/file

and then:

chmod 4755 /path/to/file


chmod a+x,u+s /path/to/file

***WARNING:*** This is a dangerous practice to adopt, as it gives everyone who uses the machine a potential window to root access. I'm assuming you are the only one using this machine so it's _less_ dangerous, but just keep that in mind for the future.

Link to comment
Share on other sites

Unfortunately, to do what you want it to, there is no other way to do it. The other thing you could do is lock down the executable permissions on the file so that only people in a certain group (for instance, your login group) can execute the binary. To do that:

chgrp yourgroup /path/to/file

chmod a-x,g+x /path/to/file

This way, even though the binary still executes as root, you will be the only one who can execute it (theoretically).

Link to comment
Share on other sites

Personally I would just add it as an exception to the sudoers file, so that even though you have to still type "sudo" to run it as root, it doesn't prompt you for your password... I personally do this for my shutdown file so that I don't have to enter my password to shutdown / reboot.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...