How to run VLC player in root

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

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

    Explanation: The initialization script check if the UID is equals to zero. Zero is reserved for the root user. Using sed to replace geteuid for getppid fools the initialization script because it is always > 0.

    While running the VLC as root is not recommended, it works. Be aware of the risks and obviously do not do it for production environments.

    Really appreciate the explanation part. A lot of people skip that, and then its just magical one liner that fixes a problem. Rather then chance to learn.

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

    recompiling is not the only way, just change the call to geteuid to deliver 1. I describe this at

    @ThorstenStaerk, thanks for providing me the information.

    Could you please mark the question as answered?

    @ThorstenStaerk : dead link...

    @Alexandre Bourlier: works (again)

  • See

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

  • 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

  • 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

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM