# Installing Xorg as root



## itslikethat (Nov 1, 2010)

If I made the mistake of installing everything in FreeBSD 8.1 as root up to this point, is a fresh re-install my only good option?

I am new to FreeBSD and recently went through the process of getting X running successfully with KDE4, Firefox and Adobe Flash Plugins showing up as installed after typing in the location bar:

```
about:plugins
```
I am now having various problems with Flash that I have determined (after reading posts on this forum) are probably related to the fact that I have been installing everything as root up to this point.  After creating a new user and adding it to the group 'wheel', I am still unable to load KDE using: 

[CMD=""]$ startx [/CMD]

It works as root, but as my new user, I get xterm instead.  Does anyone know if its better at this point to re-install Freebsd from scratch and install X and create a user to install X or is there some way I can still get X to work with my new unprivileged user?


----------



## sk8harddiefast (Nov 1, 2010)

Read my post here: http://forums.freebsd.org/showthread.php?t=18866
I think have the links and the answers on all you questions and the way to avoid a new fresh install


----------



## wblock@ (Nov 1, 2010)

itslikethat said:
			
		

> I am now having various problems with Flash that I have determined (after reading posts on this forum) are probably related to the fact that I have been installing everything as root up to this point.



That sounds like a serious misunderstanding.  Ports and packages are normally installed as root.  It's necessary, because only root has the ability to write to system directories.  If someone has advised otherwise, they may be mistaken or just misunderstood.



> After creating a new user and adding it to the group 'wheel', I am still unable to load KDE using:
> 
> [CMD=""]$ startx [/CMD]
> 
> It works as root, but as my new user, I get xterm instead.



Modify your .xinitrc or .xsession as the Handbook describes.  Following the Handbook from the start helps.  It is fact-checked and much more often correct than random advice from the average well-meaning stranger like me.



> Does anyone know if its better at this point to re-install Freebsd from scratch and install X and create a user to install X



No, don't reinstall FreeBSD.  Install ports or packages as root, then customize individual files as needed for each user.



> or is there some way I can still get X to work with my new unprivileged user?



See above.


----------



## sk8harddiefast (Nov 1, 2010)

> That sounds like a serious misunderstanding. Ports and packages are normally installed as root. It's necessary, because only root has the ability to write to system directories. If someone has advised otherwise, they may be mistaken or just misunderstood


I mean to use *sudo* command and run, with root permissions, as user on any thing ask for that. For example. Don't login as root and run "make install clean" to install a port. Login as user and run "sudo make install clean" . That Wblock says is completely right


----------



## wblock@ (Nov 1, 2010)

sk8harddiefast said:
			
		

> I mean to use *sudo* command and run, with root permissions, as user on any thing ask for that. For example. Don't login as root and run "make install clean" to install a port. Login as user and run "sudo make install clean" . That Wblock says is completely right



security/sudo is different in some ways (environment) from su(1).  To become root for installing things,
`% su -`
is fine.


----------



## DutchDaemon (Nov 1, 2010)

To me, sudo is what admins install to give _other users_ (limited) root privileges. If _you_'re the admin, there's no real need to limit yourself to sudo ... Just su to root/toor and do your work.


----------



## itslikethat (Nov 1, 2010)

Sorry my initial post wasn't clear about what I meant by installing as root.  As wblock suggested, root privileges are needed to install ports and packages, but as sk8harddiefast suggested, I gather the preferred method is to log in as a user and use su to get privileges to install packages and ports.

I have successfully used the sk8harddiefast pastie http://pastie.org/1186744 to get everything uninstalled after I logged in as a user first, then using 'su' to execute the commands in the pastie:

```
$su
Password:
Nov 1 02:00:04 homer su: homusr to root on /dev/ttyv0
homer#
```
run commands in pastie

```
homer# exit
exit
$
```

The commands in the pastie worked to clean all the packages and now I am in the process of re-installing back to where I was before and post the results of that as well.


----------



## wblock@ (Nov 1, 2010)

itslikethat said:
			
		

> I have successfully used the sk8harddiefast pastie http://pastie.org/1186744 to get everything uninstalled



That is unnecessary and brutally blows away all your configuration settings.  Don't do that, 99% of the time it's a mistake.



> The commands in the pastie worked to clean all the packages and now I am in the process of re-installing back to where I was before and post the results of that as well.



Reinstall everything that was already working seems pointless.  Afterwards, you'll still have to fix .xinitrc.


----------



## itslikethat (Nov 2, 2010)

Both methods seemed to have solved the issue.  

Since I have 3 different installs of FreeBSD on 2 different computers for testing purposes I was able to try both methods suggested in this post.  One was wiped clean of installed packages using the pastie http://pastie.org/1186744. Then I reinstalled all packages and edited .xinitrc.  On another one I just logged in as a user and edited .xinitrc as wblock suggested and as the handbook describes at http://www.freebsd.org/doc/handbook/x11-wm.html.  

I was able to get both of them to install Firefox with the Adobe Flash plugin and I am able to play Youtube videos on both without any problems.  This leads me to believe that my problems were definitely caused by running programs as root.  I also noticed many other minor issues had been resolved by running KDE4 as a user instead of as root.  

I am not showing any downside in my case to skipping the pastie and just editing .xinitrc, but I didn't really have any packages installed other than an nvidia-driver, xorg, kde4, firefox, linux_base-f10, nspluginwrapper and linux-f10-flashplugin10.


----------

