# how do you run a command as root?



## baronobeefdip (Jan 10, 2011)

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

```
# Permission Denied
```

I am logged in as root so why am I getting that message?


----------



## sk8harddiefast (Jan 10, 2011)

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


> I am logged in as root so why am I getting that message?


Not sure. Maybe wrong. But /etc/group is the first that came to my mind. Give a shot there.
Mine is like this:

```
[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.


----------



## UNIXgod (Jan 10, 2011)

add your user to /etc/group under wheel

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


----------



## Beastie (Jan 10, 2011)

baronobeefdip said:
			
		

> when I attempted to install some programs


... is a little vague.

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


----------



## baronobeefdip (Jan 10, 2011)

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.


----------



## wblock@ (Jan 10, 2011)

sk8harddiefast said:
			
		

> Never Login as root. This could harmful your system.
> Create a user and use su or sudo



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.


----------



## sk8harddiefast (Jan 10, 2011)

> 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.


:e ...





> Tools like su and sudo that give you root rights are not going to stop you from doing dangerous things.


 That's true.


----------



## baronobeefdip (Jan 10, 2011)

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.


----------



## SirDice (Jan 11, 2011)

`# pw groupmod wheel -m <user>`

See pw(8).


----------



## killnine (Jan 11, 2011)

```
sudo make me a sandwich
```

:e

(http://xkcd.com/149/)


----------

