KDE5 摸索與找到的問題 [論壇 - Ubuntu 哈啦]
正在瀏覽:
1 名遊客
KDE5 摸索與找到的問題 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員三級
![]() ![]() 註冊日期:
2017/3/23 10:15 所屬群組:
已註冊使用者 等級: 10
HP : 0 / 247
![]() |
我現在終於知道為什麼 Mint 要放棄 KDE 發行版
因為 Mint 的黃金右鍵都有 open as root (以管理員權限開啟) 原先的 kdesudo 現在在 KDE5 沒用了(從五ㄅㄨㄣ兔18.04以後),一般在五ㄅㄨㄣ兔的KDE發行版在都會檢測 UID 0 的話就會 XX as root is not possible. 但我找到答案了 ![]() https://askubuntu.com/questions/990611/how-to-run-dolphin-as-root 前面說的 18.x - 19.x pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dolphin 17.x 這招沒用 ![]() export XDG_CURRENT_DESKTOP=KDE; LD_PRELOAD=/home/roger/Downloads/dolphin/usr/lib64/libkdeinit5_dolphin.so /usr/bin/dolphin 他說下載 openSuSE 的 dolphin 17.12 rpm套件 (因為五ㄅㄨㄣ兔 18.04 是 dolphin 17.12) 解開之後放在 =/home/roger/Downloads/dolphin/usr/lib64/ 然後用 LD_PRELOAD 載入,結果一樣沒路用... ![]() 但真相只有一個,真的或假的,最後面的話才是真理 ![]() 問題出在他的原始碼 /** * Check whether we are running as root **/ if (getuid() == 0) // uid = user id = 0 ==> means if you are user 0 (aka root) { std::cout << "Executing Kate as root is not possible. To edit files as root use:" << std::endl; std::cout << "SUDO_EDITOR=kate sudoedit <file>" << std::endl; return 0; } 不只 dolphin、Kate,很多KDE套件都有這段,所以在一般使用者帳號,沒辦法用root權限執行圖形介面的應用。 所以目前的 KDE5 (五ㄅㄨㄣ兔 18.04 dolphin 17.12 的版本)要在 一般的使用者帳號用root權限開啟圖形界面的應用 有三條路: 1. 原始碼要重編 去掉 root 權限檢測... 太多套件了... 2. 打二進位補釘,這個比較方便,不過很多套件都要打。 3. 出個像之前的 kdesudo 目前沒人出 ![]() dolphin 18 的版本還沒測試.... 當然上面打個指令用root權限打開是最方便的...但測試後就是沒路用 ![]() dolphin 19 可以 pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dolphin dolphin 17.12 二進位補釘 找尋 HEX 0f 84 58 1a 00 00 替換 HEX 90 90 90 90 90 90 替換指令: sudo perl -pi -e 's|\x0f\x84\x58\x1a\x00\x00|\x90\x90\x90\x90\x90\x90|g' /usr/lib/x86_64-linux-gnu/libkdeinit5_dolphin.so 醬子 dolphin 就可以用 sudo dolphin 打開了 ![]() ![]()
2019/12/7 6:47
|
||||||||||
![]() |
回覆: KDE5 摸索與找到的問題 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員三級
![]() ![]() 註冊日期:
2017/3/23 10:15 所屬群組:
已註冊使用者 等級: 10
HP : 0 / 247
![]() |
二進位補釘可能每個編譯器標出來的代碼會不一樣,所以每個發行版可能補釘會不同
最終要在各發行版打補釘的人,必須會分析操作代碼找補釘位置 版本: 五ㄅㄨㄣ兔 18.04 dolphin 17.12 範例: libkdeinit5_dolphin.so 找尋Function kdemain .text:0000000000041F70 public kdemain .text:0000000000041F70 kdemain proc near .text:0000000000041F9B call _getuid ; 取得UID的值 .text:0000000000041FA0 test eax, eax ; 檢查 UID 是否等於 0 .text:0000000000041FA2 jz loc_43A00 ; 是 0 就跳 (改為 NOP) .text:0000000000041FA8 lea rax, [rsp+148h+var_A8] .text:0000000000041FB0 lea rsi, [rsp+148h+var_EC] ; int * .text:0000000000041FB5 mov ecx, offset loc_50904 ; int .text:0000000000041FBA mov rdx, rbx ; char ** .text:0000000000041FBD lea r14, [rsp+148h+var_88] .text:0000000000041FC5 lea rbx, [rsp+148h+var_68] .text:0000000000041FCD mov rdi, rax ; this .text:0000000000041FD0 mov [rsp+148h+var_110], rax .text:0000000000041FD5 lea r15, [rsp+148h+var_98] .text:0000000000041FDD call __ZN12QApplicationC1ERiPPci ; QApplication::QApplication(int &,char **,int) .text:0000000000043A00 loc_43A00: .text:0000000000043A00 mov rbx, cs:_ZSt4cout_ptr .text:0000000000043A07 lea rsi, aExecutingDolph ; "Executing Dolphin as root is not possib"... .text:0000000000043A0E mov edx, 2Ah .text:0000000000043A13 mov rdi, rbx .text:0000000000043A16 call __ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l ; std::__ostream_insert<char,std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,char const*,long) 長跳轉 6 byte offset 0x41FA2 0f 84 58 1a 00 00 改為 90 90 90 90 90 90 版本: dolphin 19.08 範例: Kali 2019.4 libkdeinit5_dolphin.so 找尋Function kdemain .text:0000000000043A6B call _getuid ; 取得UID的值 .text:0000000000043A70 test eax, eax ; 檢查 UID 是否等於 0 .text:0000000000043A72 jnz short loc_43AA8 ; 不是 0 就跳 (改為 jmp 0xEB) .text:0000000000043A74 lea rdi, aSudo_user ; "SUDO_USER" .text:0000000000043A7B call __Z27qEnvironmentVariableIsEmptyPKc ; qEnvironmentVariableIsEmpty(char const*) .text:0000000000043A80 test al, al .text:0000000000043A82 jz loc_45678 .text:0000000000043A88 lea rdi, aKdesu_user ; "KDESU_USER" .text:0000000000043A8F call __Z27qEnvironmentVariableIsEmptyPKc ; qEnvironmentVariableIsEmpty(char const*) .text:0000000000043A94 mov edx, 57h .text:0000000000043A99 lea rsi, aExecutingDolph ; "Executing Dolphin with kdesu is not pos"... .text:0000000000043AA0 test al, al .text:0000000000043AA2 jz loc_45684 .text:0000000000043AA8 .text:0000000000043AA8 loc_43AA8: 短跳轉 2 byte offset 0x43A72 75 34 改為 EB 34
2019/12/7 7:58
|
||||||||||
![]() |
您可以查看帖子.
您不可發帖.
您不可回覆.
您不可編輯自己的帖子.
您不可刪除自己的帖子.
您不可發起投票調查.
您不可在投票調查中投票.
您不可上傳附件.
您不可不經審核直接發帖.