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.

  • Can you explain why you need to run it as sudo? – DavidG Jan 31 '14 at 14:21
  • Try launching VLC instance without elevated privileges. Any particular reason you are trying to launch from CLI? – fleamour Jan 31 '14 at 14:21
  • because i often use it that way being the reasoun i can run command without always writing password .. – user242125 Jan 31 '14 at 14:22
  • There is no reason in running it with that high privilege. Can you elaborate more on this? – slowbanned Jan 31 '14 at 14:25
  • No need to be unfriendly. Your explanation is not really understandable. – davidbaumann Jan 31 '14 at 14:32
up vote 5 down vote accepted

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.

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.

  • ill look there .. but why you cannot use vlc in sudo? is a reason there? – user242125 Jan 31 '14 at 14:34
  • 1
    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. – DavidG Jan 31 '14 at 14:38

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.

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.

The following worked for me:

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

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

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.