Difference between pages "Compose keys" and "Run vlc as root"

From Linuxintro
(Difference between pages)
imported>ThorstenStaerk
 
imported>ThorstenStaerk
 
Line 1: Line 1:
If you press a '''`''' and an '''e''', you get an '''è'''. In this case the key '''`''' is called a [[dead key]] because it is at first stroke dead. A bit more tricky is the compose key. Press the compose key and then type two keys, and both keys will be combined. E.g. type the compose key, then the comma, then '''c''' and the outcome is '''ç'''.
+
When starting [[vlc]] as root you will probably get the following [[error message]]:
 +
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).
 +
Here is how I change this behavior:
 +
[[gdb]] /usr/bin/vlc
 +
(gdb) info functions
 +
All defined functions:
 +
 +
Non-debugging symbols:
 +
[...]
 +
0x0000000000400f40  geteuid
 +
[...]
 +
Let's break in the function to get the effective user identity:
 +
(gdb) break geteuid
 +
Breakpoint 1 at 0x400f40
 +
Let's start the program to run till the first breakpoint:
 +
(gdb) run
 +
Starting program: /usr/bin/vlc
 +
 +
Breakpoint 1, 0x00007ffff71cfc70 in geteuid () from /lib64/libc.so.6
 +
ok, let's trace the program one command at a time:
 +
(gdb) stepi
 +
0x00007ffff71cfc75 in geteuid () from /lib64/libc.so.6
 +
(gdb) stepi
 +
0x00007ffff71cfc77 in geteuid () from /lib64/libc.so.6
 +
(gdb)
 +
0x0000000000401103 in ?? ()
 +
(gdb)
 +
0x0000000000401105 in ?? ()
 +
(gdb)
 +
Ok, let's look at this program part with a disassembler:
 +
[[objdump]] -d -M intel /usr/bin/vlc
 +
[...]
 +
  4010f9:      e8 32 0a 00 00          call  401b30 <unsetenv>
 +
  4010fe:      e8 3d fe ff ff          call  400f40 <geteuid@plt>
 +
  401103:      85 c0                  test  eax,eax
 +
  401105:      0f 84 04 06 00 00      je    40170f <fflush@plt+0x66f>
 +
  40110b:      be ca 1f 40 00          mov    esi,0x401fca
 +
  401110:      bf 06 00 00 00          mov    edi,0x6
 +
[...]
 +
If you do not have exactly the same vlc version as I have, yours will probably look different. In this case just follow the instructions below and assume your values instead of this example.
  
Let's define your right Windows key as your compose key. To do this, [[open a console]], start the [[program]] [[xev]] and press the right Windows key. You get an output like
+
It seems as if (address) 4010fe calls geteuid, 401103 prepares a conditional jump and 401105 jumps if equal somewhere. So we call a [[hexeditor]]:
  KeyPress event, serial 34, synthetic NO, window 0x3400001,
+
  okteta /usr/bin/vlc
    root 0x1d8, subw 0x0, time 287118161, (229,-209), root:(233,584),
+
and replace
    state 0x10, keycode '''''134''''' (keysym 0xff20, Multi_key), same_screen YES,
+
0f 84 04 06 00 00
    XKeysymToKeycode returns keycode: 116
+
by some instructions to wait:
    XLookupString gives 0 bytes:
+
90 90 90 90 90 90
    XmbLookupString gives 0 bytes:
+
When calling vlc now as root, it does not abort :)
    XFilterEvent returns: True
 
You see the keycode is '''''134'''''. So define it as your compose-key:
 
xmodmap -e "keycode ''134'' = Multi_key"
 
Now press the right Windows key, then the ",", then the "c". You see a "ç". Cool, eh?
 
  
There are many more combinations, but all of them will be forgotten if you start a new graphical session. To keep the change, create a file ~/.Xmodmap containing the line:
+
Also, once the following worked:
  keycode 134 = Multi_key
+
  sed -<abbr title="in-place edit in the file">i</abbr><abbr title="extended regular expressions">r</abbr> "s/\x0f\x84..../\x90\x90\x90\x90\x90\x90/g" vlc
Then press Ctrl_Alt_Backspace to restart your X Window System.
 
 
 
=  Key combinations =
 
{|class="wikitable sortable" border=1
 
! You want !! you type the compose key plus
 
|-
 
| ä || "a
 
|-
 
| ö || "o
 
|-
 
| ü || "u
 
|-
 
| Ä || "A
 
|-
 
| Ö || "O
 
|-
 
| Ü || "U
 
|-
 
| ß || ss
 
|-
 
| ą || ;a
 
|-
 
| ę || ;e
 
|-
 
| ć || 'c
 
|-
 
| ś || 's
 
|-
 
|}
 
 
 
The compose keys are defined for the english locale in /usr/share/X11/locale/en_US.UTF-8/Compose
 
  
 
= See also =
 
= See also =
* [[configure your keyboard layout]]
+
* [[vlc]]
* [[keyboard]]
+
* [[gcc]]
 +
* [[objdump]]
 +
* http://try-linux.blogspot.de/2013/02/run-vlc-as-root.html

Revision as of 17:06, 3 November 2013

When starting vlc as root you will probably get the following error message:

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

Here is how I change this behavior:

gdb /usr/bin/vlc
(gdb) info functions
All defined functions:

Non-debugging symbols:
[...]
0x0000000000400f40  geteuid
[...]

Let's break in the function to get the effective user identity:

(gdb) break geteuid
Breakpoint 1 at 0x400f40

Let's start the program to run till the first breakpoint:

(gdb) run
Starting program: /usr/bin/vlc 

Breakpoint 1, 0x00007ffff71cfc70 in geteuid () from /lib64/libc.so.6

ok, let's trace the program one command at a time:

(gdb) stepi
0x00007ffff71cfc75 in geteuid () from /lib64/libc.so.6
(gdb) stepi
0x00007ffff71cfc77 in geteuid () from /lib64/libc.so.6
(gdb) 
0x0000000000401103 in ?? ()
(gdb) 
0x0000000000401105 in ?? ()
(gdb) 

Ok, let's look at this program part with a disassembler:

objdump -d -M intel /usr/bin/vlc
[...]
 4010f9:       e8 32 0a 00 00          call   401b30 <unsetenv>
 4010fe:       e8 3d fe ff ff          call   400f40 <geteuid@plt>
 401103:       85 c0                   test   eax,eax
 401105:       0f 84 04 06 00 00       je     40170f <fflush@plt+0x66f>
 40110b:       be ca 1f 40 00          mov    esi,0x401fca
 401110:       bf 06 00 00 00          mov    edi,0x6
[...]

If you do not have exactly the same vlc version as I have, yours will probably look different. In this case just follow the instructions below and assume your values instead of this example.

It seems as if (address) 4010fe calls geteuid, 401103 prepares a conditional jump and 401105 jumps if equal somewhere. So we call a hexeditor:

okteta /usr/bin/vlc

and replace

0f 84 04 06 00 00

by some instructions to wait:

90 90 90 90 90 90

When calling vlc now as root, it does not abort :)

Also, once the following worked:

sed -ir "s/\x0f\x84..../\x90\x90\x90\x90\x90\x90/g" vlc

See also