How to use Vlc with sudo privileges?

19,725

Solution 1

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.

Solution 2

You really should not be logged in as root all the time. End of story. A lot of programs and applications will detect this and refuse to run, because it's bad practice.

If the only reason you have to run as root is to avoid being bothered to enter your password when you run a potentially system-damaging command (also there for your protection), you can simply configure sudo to not require the password all the time.

You will still have to type "sudo" before running some commands, but it will not ask for the password.

Bu default you should already be in the sudo group, so just do this:

visudo

Then look for this line:

%sudo   ALL=(ALL:ALL) ALL

Change it to:

%sudo   ALL=(ALL) NOPASSWD: ALL

Then save the file and exit. Then it will not ask for your password every time.

Solution 3

Sudo is your friend, it is there to protect you. If you really just don't want to type your password and you don't care about the security then you should look into ssh-agent. It can save your password so you will only need to type your password once per session.

Solution 4

But to play these files I need VLC with sudo. I think it's a good reason.

No, you're jumping to conclusions without thinking twice about possible causes for the issue you have and side effects or damage done to your installation by using such a crude workaround.

Solution 5

The following worked for me:

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

credit to @rodvlopes : https://unix.stackexchange.com/a/199422

Share:
19,725

Related videos on Youtube

user242125
Author by

user242125

Updated on September 18, 2022

Comments

  • user242125
    user242125 over 1 year

    I'm trying to use Vlc with sudo but it doesn't work.

    This is the 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).
    

    Can you help me here?

    Edit: I am adding a reason after reading comments.

    I just want to give one reason: I am using mac + ubuntu and my movies collection are in mac boot disk. which is shown as read only form ubuntu(I don't know why) and I cant run chmod on files. I can access Movies,Documents files using nautilus with sudo. But to play these files I need VLC with sudo. I think it's a good reason.

    • DavidGamba
      DavidGamba about 10 years
      Can you explain why you need to run it as sudo?
    • fleamour
      fleamour about 10 years
      Try launching VLC instance without elevated privileges. Any particular reason you are trying to launch from CLI?
    • user242125
      user242125 about 10 years
      because i often use it that way being the reasoun i can run command without always writing password ..
    • Csabi Vidó
      Csabi Vidó over 9 years
  • user242125
    user242125 about 10 years
    ill look there .. but why you cannot use vlc in sudo? is a reason there?
  • DavidGamba
    DavidGamba about 10 years
    I am sure they have security in mind, applications that play online (downloaded) content are prone to attacks and running with elevated privileges makes a successful attack way more dangerous.
  • user242125
    user242125 about 10 years
    ok ... this is better..
  • Hitechcomputergeek
    Hitechcomputergeek over 8 years
    I'm copying/pasting this from another question (asked later), but you can also use sudo sed -i 's/geteuid/getppid/' /usr/bin/vlc. (from unix.stackexchange.com/questions/125546/…)
  • shevy
    shevy almost 4 years
    Very useful answer - so much better than the non-answers above like "why do you need to do this". This is why stackoverflow and its offsprings are useful still.