Link to home
Start Free TrialLog in
Avatar of jameswalt
jameswalt

asked on

Neet to su without entering root password

Hello,

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.
Avatar of PsiCop
PsiCop
Flag of United States of America image

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.
ASKER CERTIFIED SOLUTION
Avatar of PsiCop
PsiCop
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of _iskywalker_
_iskywalker_

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