The VLC player is rumoured to be one of the best players to day for playing many different formats including mts and m2ts proprietary SONY formats. (Which just so happens to be the format of my Camcorder movies) This is the way my camcorder has been saving them in and to date, there are few if any players out there capable of playing such files without first converting them (A notable exception is now Windows 7 that has this capability built in natively).

Thankfully the VLC player does the job neatly playing these two type of files well on my recent Windows 7 installation. However, I wanted to play it on Linux where I work and would like to watch the occassional movie. I was glad to see that VLC has copies for Linux as well. Unfortunately, it does not run natively from the previlidged root account and requires a regular no previlidged user account. Here is how to satisfy these conditions, run VLC from an unprevilidged account while you are logged in through the root account.

A NOTE OF CAUTION:

Running anything from the previlidged account is generally frowned upon: meaning you should NOT run things from the previlidged user unless you really, really know what it is that you're doing. The general practice is to run non critical system software from unprevilidged users so in case of compromise, the compromise is contained to that user only. Good network security (ie a secure firewall and/or router configuration) is also mandatory here to prevent uninvited guests. The reader will need to judge if these instructions are appropriate for their environment, otherwise the below instructions are NOT recommended.

YOU HAVE BEEN WARNED

QUICK INSTRUCTIONS

To run VLC player from a non previlidged account while you are logged in using root, a previlidged account, below is a set of quick steps to accomplish this. These steps will create a non previlidged account to run VLC from, setup a menu icon to run it at a click of a button, all while logged into the previlidged root account:

Run useradd -d /home/videouser -s /bin/bash videouser (You may change the options to suit your environment. If you already have a user, you can substite that user instead of videouser)

Set a password for this user: # passwd videouser

Check the permissions of the X11 socket (You may see something like srwxrwxrwx meaning permissions are fine):ll /tmp/.X11-unix/X0

Copy the ~/.Xauthority to the users home folder and modify ownership (A copy may also be under /var/run/kdm in case yours is empty- see below):
# scp -rp /root/.Xauthority /home/videouser/
# chown videouser /home/videouser/.Xauthority
# chgrp videouser /home/videouser/.Xauthority

(Optional)Create a script to run and prepare the environment so VLC Player will work after reboots.

INVESTIGATION / RESOLUTION

Having said this, here is the original issue and the eventual investigation and resolution steps:

[root@tom ~]# vlc
VLC is not supposed to be run as root. Sorry.
If you need to use real-time priorities and/or privileged TCP ports
you can use vlc-wrapper (make sure it is Set-UID root and
cannot be run by non-trusted users first).[root@tom ~]# vlc-wrapper
Cannot determine unprivileged user for VLC! [root@tom ~]#

So the natural course of action is to run it as a non privilidged user as such:

Bringing us to the original problem we will discuss: An X server permission problem. Need to run VLC from the same user as the one that is logged into the GUI.

The solution here was the result of a little bit of help from the VideoLAN folks though the end result was somewhat different You need to give the user permission to read and write the X11 socket (usually /tmp/.X11-unix/X0) and read the cookie file (~/.Xauthority).

Note that the SECOND SOLUTION to this issue is recommended over this one. The root account (and folder) is not accessible to any users and so cannot be changed in any secure fashion. This is because one would need to add the user account to the root group (ie elevate the user account permissions which would open a relatively BIG security hole)

Then ran VLC and it ran smoothly again. This is a slightly safer approach as it doesn't expose the root account to such a degree as before (Through elevation of a regular user account by assigning the user to the root group). This will allow the player to work for this session but upon reboot, the player won't work again. See below to counter this issue.

VLC GUI LAUNCHER MODIFICATION

To get the VLC player to work from the Gnome Menu's, you can change the command line of the icon it installs under to call:

Command: su – videouser -c 'vlc' %U

instead of:

Command: vlc %U

by editing the icon properties from System -> Preferences -> Main Menu. The words Main Menu is short for the Alacarte GNOME Menu Editor (No idea why why the menu icon doesn't use this name. ). The complete panel with the new VLC settings appears like this:

I don't have that menu editor?

If you are missing the icon/utility, you can install it in the following manner:

something that of course can be scripted, since, after all, you are logging into the root account anyway. A short script that is essentially the steps from the second approach, can be called before launching the VLC Player of the GUI icon command line:

It appears I'm missing the livdvdcss and libdvdcss2 libraries as noted on the VideoLAN site. However the instructions there point to using the subversion repositories which might mean some fancy compiling. I'd rather use RPM / YUM so off I went searching for a suitable RPM of the packages. Sure enough, the folks at the ATrpms site had what I was looking for. After spending a few minutes configuring my yum /etc/yum.conf file according to their instructions I was greeted with a proper list of RPM's related (at least seemingly) to what I needed:

Strangely enough, the URL for the libdvdcss had a link back to videolan.org yet I couldn't locate a suitable RPM on the videolan.org site. Nontheless, I proceeded to install the libraries trying to add libbluray along with it (Maybe I'll get one of these in the future) but it looks like libbluray is a tougher find.

Turns out that I needed to edit the /etc/group file and add videouser user to the audio user group of users who are allowed to have audio while the root login is in session. The line should like like this:

[…] would still be logged in with the root account), but it should be usable for your purposes: VLC: VideoLAN video player: Failed to connect to the D-Bus session daemon: /bin/dbus-launch terminat… HAOF Reply With Quote + Reply to […]

I´m trying to stream a video file without graphic interface using cvlc, and i have the error that u describe in the post. I don´t have any graphic package instaled. I tryed what you said but I can find /tmp/.X11-unix/X0, I´m using centos and installed vlc without errors. Do u have some hint?
thanks in advance
Luis