We help IT Professionals succeed at work.

Neet to su without entering root password

jameswalt asked
Medium Priority
Last Modified: 2011-10-03

is there any way for a non-root user to su to root without entering a password?

I looked for a -p option on su but to no avail.

I need for a script to run a program as root and then get back out

i was hoping for something like this:

su -p password -c command

so far I only see the ability to su and manually type the password.
Watch Question


you can specify certain programs to allow all users to run it as root....is this what your asking?
sudo will still require you to enter a password though.
Actually, bigjimbo813, that is configurable. You can tell sudo to *not* require a password for specific commands or specific users. Try using it some time.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
sudo does not require password with you put the users in the sudoers group.
another way to make a user execute a program with root priviledges is putting the s bit, like bigjimbo812 said:
make root own that file, then chmod 755 file then chmod +s file. man chmod, for questions

SUID programs are a Very Bad Idea (tm) in the modern security environment. If there are any holes in the SUID'd program, they become exploitable with root privilege.

sudo is the tool you want to use. It provides *controlled* privilege escalation that can be logged and audited.
Sudo is a good solution.

I depends on what you want to do under root privileges. Maybe you can simply add user in the good groups ?
i agree sudo would be the best option....I just was not aware you could configure it to not require a password. Thanks for the tip Psi
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.