I have installed a vlc in centos 6.5. I want to run it as root. But I get the following error,

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

  • 13
    Out of curiosity, what would be the reason to do this ? – kursus Apr 19 '14 at 14:09
  • 2
    So use vlc-wrapper like it says? – Kevin Apr 19 '14 at 20:41
  • 3
    Pro-tip: Do not do this. – HalosGhost Jun 30 '14 at 22:14
  • 1
    Hope this helps you out. hackingzones.com/run-vlc-as-root-in-linux-ubuntu-pear-os Chirag Singh – chirag Hz Feb 12 '15 at 21:08
  • 1
    On some levels the link referenced is an interesting hack (use a hex editor to replace the getuid call with getpid) since source code is available, a cleaner approach would be to edit the source to remove the test completely, and recompile. In both cases I would recommend against doing so, but if you want to shoot your foot off . . . – hildred Feb 12 '15 at 22:51

This is what worked for me. No compilation required.

sed -i 's/geteuid/getppid/' /usr/bin/vlc

Using VLC media player 2.0.3 Twoflower on a Raspberry Pi.

  • 3
    Worked like a charm. :) – Krishnadas PC Jul 13 '15 at 1:29
  • 3
    Yeah This Is Hell :) +1 – onalbi Dec 26 '15 at 21:12
  • hahaha patching it to check pid instead of uid, and it works great. awesome hack! – hanshenrik Apr 26 at 23:08
  • 1
    This worked amazing on vlc 3.0.1 as well – Ofer Sadan Jun 8 at 5:51

One way around this is recompiling. Pass the --enable-run-as-root flag to ./configure and vlc should be able to run as root. The above answer is from here.

See http://www.linuxintro.org/wiki/Run_vlc_as_root:

  • backup the VLC binary:

    # cp /usr/bin/vlc /usr/bin/vlc-backup
    
  • find the call to geteuid inside the VLC binary:

    # needle=$(objdump -d /usr/bin/vlc | grep euid | tail -1 | awk '{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6;}')
    
  • replace the call to just deliver 01:

    # sed -ir "s/$needle/\xb8\x01\x00\x00\x00/" /usr/bin/vlc
    
  • test it

VLC should now run under the root user!

You will be able to run VLC as root by modifying the VLC binary, located in /usr/bin

First, you'll need a hex-editor, like Bless:

sudo apt-get install bless

Then, you'll open the VLC binary with the hex-editor:

sudo bless /usr/bin/vlc

Search and change the geteuid string by getppid, save and exit.

You can now launch VLC as root.

VLC is not supposed to be run as root. Sorry. – Solution

Anyways, i installed vlc using following command ;

# aptitude install vlc

And tried to run vlc as root i got error on my terminal ;

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

This error says straight forward vlc can not be run as root privileged user. What to do now? Don’t be panic. Here is the hacked solution 😀

# vi /usr/bin/vlc

search for geteuid and replace it with getppid

Save file & Exit.

Now it should work, try to run it again 😉

or

sed -i 's/geteuid/getppid/' /usr/bin/vlc
  • Identical solution that given in rodvlopes answer 18 months earlier! – user13757 Mar 14 '17 at 15:48

Go to main menu find vlc and set property as:

gksu -u vlc

or simply in terminal type

gksu -u <username(no root)> vlc

For example, if you have abc user your command will be:

gksu -u abc vlc

Kevin in comments of the question suggested using vlc-wrapper. I had troubles finding out how to use it so I'll describe how I made it work:

you need to set your non-privileged user in SUDO_UID: export SUDO_UID=1000

if you don't have a user to run vlc under create one:

useradd -g users vlc
# this will show you the uid of vlc user
id -u vlc

if you want SUDO_UID variable permanent, add it to bashrc:

echo "export SUDO_UID=1000" >> /root/.bashrc

be careful not to write single > instead of >>

then use vlc-wrapper instead of vlc

sed -i 's/geteuid/getppid/' /usr/bin/vlc

It works.

  • 1
    It would be good if you could explain why this particular answer solves the problem. – Jeff Schaller Dec 29 '15 at 11:55
  • 1
    Identical solution that given in rodvlopes answer 8 months earlier! – user13757 Mar 14 '17 at 15:49
  • -1 because it's a copy-paste of another answer on this exact page. – aggregate1166877 Jan 20 at 5:16
  • @Jeff Schaller If geteuid returns 0, vlc knows it's root. However, getppid will always return a non-zero result, and the length of its name is conveniently the same as that of geteuid. Thus, the binary now links getppid in place of geteuid, and vlc never realizes it's root! – George Jan 29 at 23:58
  • @George I am aware of what it’s doing; I was hoping that user149272 could improve their answer with an explanation. – Jeff Schaller Jan 30 at 0:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.