1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how do you run a command as root?

Discussion in 'General' started by baronobeefdip, Jan 10, 2011.

  1. baronobeefdip

    baronobeefdip New Member

    Messages:
    123
    Likes Received:
    0
    I have gotten the desktop working and everything looks great, But when I attempted to install some programs after I logged in as root it echoes back with the message
    Code:
    # Permission Denied
    
    I am logged in as root so why am I getting that message?
     
  2. sk8harddiefast

    sk8harddiefast Member

    Messages:
    2,009
    Likes Received:
    4
    Never Login as root. This could harmful your system.
    Create a user and use su or sudo
    Su come with the system. For sudo you must install it from ports security/sudo
    Not sure. Maybe wrong. But /etc/group is the first that came to my mind. Give a shot there.
    Mine is like this:
    Code:
    [B]wheel:*:0:root,emberdaemon[/B]
    daemon:*:1:
    kmem:*:2:
    sys:*:3:
    tty:*:4:
    operator:*:5:root,emberdaemon
    mail:*:6:
    bin:*:7:
    news:*:8:
    man:*:9:
    games:*:13:
    ftp:*:14:
    staff:*:20:
    sshd:*:22:
    smmsp:*:25:
    mailnull:*:26:
    guest:*:31:
    bind:*:53:
    proxy:*:62:
    authpf:*:63:
    _pflogd:*:64:
    _dhcp:*:65:
    uucp:*:66:
    dialer:*:68:
    network:*:69:root,emberdaemon
    audit:*:77:
    www:*:80:
    nogroup:*:65533:
    nobody:*:65534:
    messagebus:*:556:
    polkit:*:562:root,emberdaemon
    haldaemon:*:560:
    avahi:*:558:
    vboxusers:*:920:emberdaemon
    cyrus:*:60:
    mysql:*:88:
    pulse:*:563:
    pulse-access:*:564:
    pulse-rt:*:557:
    cups:*:193:root,emberdaemon
    Add root on wheel group.
     
  3. UNIXgod

    UNIXgod New Member

    Messages:
    1,089
    Likes Received:
    0
    add your user to /etc/group under wheel

    then su to root user account from non privileged(i.e. regular) user.
     
  4. Beastie

    Beastie Member

    Messages:
    1,916
    Likes Received:
    1
    ... is a little vague.

    Maybe you could tell us exactly what command you ran that returned the error.
     
  5. baronobeefdip

    baronobeefdip New Member

    Messages:
    123
    Likes Received:
    0
    I was trying to install Webmin, Because i can't get the one from the ports to work. When i copy the URL address that the installation came out with to the browser, It says there was a problem loading the page. I have had more luck installing it from tarball. I was also trying to install samba. I was going to run autogen.sh and it gave me the Permission Denied message. I know that samba is in the ports but for some reason they want us to install it from source.
     
  6. wblock@

    wblock@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    11,164
    Likes Received:
    7
    Respect root and use it sparingly, but "never" is too severe. If you're sitting in front of the console and want to do an installworld, it would be pointless to log in as a normal user and then su.

    Tools like su and sudo that give you root rights are not going to stop you from doing dangerous things. sudo might be worse in that regard, because it's more complicated to set up, and may give a false sense of security.
     
  7. sk8harddiefast

    sk8harddiefast Member

    Messages:
    2,009
    Likes Received:
    4
    :e ...
    That's true.
     
  8. baronobeefdip

    baronobeefdip New Member

    Messages:
    123
    Likes Received:
    0
    Just got it, During the installation of the operating system, At the part where it asked me to create user accounts I put one of them in the Wheel group now it has root privileges.
     
  9. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,359
    Likes Received:
    0
    # pw groupmod wheel -m <user>

    See pw(8).
     
  10. killnine

    killnine New Member

    Messages:
    3
    Likes Received:
    0