How can I create and grant a normal user with root privileges?

30,371

Solution 1

Under no circumstances would anyone want to do that. This is what sudo is for, to give users the ability to run things as root. Giving a non-root user all the permissions of root is inadvisable because they would then be able to do literally anything, so if that user account was hijacked, you'd be in trouble.


Summary of above: Don't try to give the user root abilities for everything, that's not possible. Use sudo [command] to run items as superuser if you need to.

Solution 2

You don't need to create 'sybase' as a privileged user.

See http://tldp.yolinux.com/HOWTO/Sybase-ASE-HOWTO.html for examples. Useful info:

"create the sybase user group and then the sybase user as a member of it. This is an ordinary user that will be used mainly for starting the database server"

bash$ su - root
bash# groupadd sybase
bash# useradd -g sybase -d /home/sybase -c "Sybase ASE DBA account" -p Hard2Guess sybase
Share:
30,371

Related videos on Youtube

jeffery_the_wind
Author by

jeffery_the_wind

Updated on September 18, 2022

Comments

  • jeffery_the_wind
    jeffery_the_wind over 1 year

    I'm wondering how to create and grant a normal user (for example, named 'sybase') with root privileges?

    I found useradd, adduser, and passwd to be useful, but are there any other files to modify to get 'root'-like privileges, so that user can do installation tasks?

  • Sirex
    Sirex almost 13 years
    In production yes. In testing anything is fair-game.
  • drjors
    drjors almost 13 years
    Still inadvisable for that very same reason... in any environment.
  • jeffery_the_wind
    jeffery_the_wind almost 13 years
    to build a sybase dataserver, i need to have 'sybase' user which must have similar privileges as root.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 13 years
    @Sirex In testing, you give everything the same permissions as on the production system (except that you, the tester, have all privileges). Otherwise it's not much of a test.
  • Michael Mrozek
    Michael Mrozek almost 12 years
    @Gilles You should post the UID 0 part as a separate answer; that's the actual answer to the question
  • Michael Mrozek
    Michael Mrozek almost 12 years
    wheel generally just lets you use sudo; it doesn't magically make your account root
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 12 years
    @MichaelMrozek Uh? No, the answer to the general question is sudo, which Lord of Time already provided. The answer to the specific example of Sybase has been given by Rory Alsop.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 12 years
    The wheel group doesn't directly grant a user root privileges. Traditionally, it allows a user to use su (and become root by typing the root password). On some systems, it allows the user to run sudo (and become root without additional credentials), but this is not very widespread. See unix.stackexchange.com/questions/4460/…
  • Michael Mrozek
    Michael Mrozek almost 12 years
    @Gilles Then maybe I'm reading it wrong, but so is Lord of Time from the sound of it. I'm reading it as "how do I make the system treat this user like they're root", and the answer is "you can't, but you can use sudo to run commands as root, which is good enough"
  • drjors
    drjors almost 12 years
    Which was my recommendation, @Michael. "This is what sudo is for, to give users the ability to run things as root." <-- in effect, that quote from my year-old answer states "Use sudo". I've added that part (the "Summary") to the answer, though.
  • Michael Mrozek
    Michael Mrozek almost 12 years
    @LordofTime Well, before your answer said "you shouldn't", and I generally don't like those answers -- if it's possible, tell them how, and mention why it's a terrible idea. In this case it turns out the answer really is "you can't", which is different
  • drjors
    drjors almost 12 years
    @MichaelMrozek do remember i wrote this answer a year ago, when I didnt have a knack for correctly wording answers :P I agree, I don't like those answers either, at the time, though, well... lets just say that in hindsight, i believe i could have worded it better.
  • flyagaricus
    flyagaricus about 11 years
    This answer doesn't answer the question asked. Stack Exchange isn't a forum for discussing things, it is a place to ask questions and find answers to those questions.
  • geoidesic
    geoidesic over 9 years
    This answer should be a comment. It's a relevant opinion providing support for the user's answer. By your standard, the accepted answer should not be accepted or allowed because it also doesn't answer the question - it advises against asking the question!
  • MacGyver
    MacGyver over 7 years
    This fails when running the command "hostname somehost" .. not sure if there are others