enable chrome remote desktop from ssh

you may encounter below problem when you ssh -XC to a remote PC and want to enable chrome remote desktop

org.freedesktop.PolicyKit1.Error.Failed: No session for cookie

I fix by sudo vim /etc/group and append my id to group “chrome-remote-desktop:x:1007:owen"

echo "chrome-remote-desktop:x:1007:owen" >> /etc/group

google-chrome-remote using pkexec to run as root and try to modify /etc/group, but pkexec cannot grant permission via ssh

so just add the group and add your account

change php exec shell to bash

當我們用 php 的 exec 指令,想要叫電腦執行某些指令或者 shell script 時候

可能會遇到問題

因為 exce 使用 /bin/sh 作為執行的環境,而 linux 有可能使用 /bin/sh -> /bin/dash 當作 /bin/sh 來使用

而 dash 沒有 source 這種 shell command,bash 才有。

這是第一個問題

第二個問題:當我rm /bin/sh;sudo ln -s /bin/bash /bin/sh

看起來應該可以讓我的 php 的 exec() 使用 bash 作為執行環境了

但是為什麼動作的結果和我自己在登入電腦之後在 bash 環境下執行的結果不一樣?

例如 source .bashrc ,顯示 file not found

在 sh 的情況下是因為在 PATH 裡面搜尋不到檔案的話, sh 不會到當前目錄再進行搜尋

但是 bash 在 PATH 裡面搜尋不到檔案的話, bash 是會到當前目錄進行搜尋的

BUT,當我把 /bin/sh -> /bin/bash 之後,用 exec 呼叫,他似乎不是這樣運作…what the fuxx …

解法:

exec("/bin/bash -c"source .bashrc" ");

這樣,我解決了我的問題。但我依然不知道 exec 執行的時候用 bash 跟我帳號登入機器執行 bash 為什麼會不一樣!

Ubuntu 10.04.3 用來編譯 Android 作業系統 /etc/apt/sources.list

基本上,編譯 Android 很單純,就是…

1. 安裝 Ubuntu10.04
http://ftp.twaren.net/ubuntu-cd/lucid/
我是安裝64-bit PC server 版
http://ftp.twaren.net/ubuntu-cd/lucid/ubuntu-10.04.3-server-amd64.iso

2. 按照http://source.android.com/source/initializing.html
這個頁面來設置環境

過程中我被無法正常存取的 repository 耗了近三個小時
推薦使用下面這個,交大資訊系的!
/etc/apt/sources.list

# deb cdrom:[Ubuntu 10.04.3 LTS _Lucid Lynx_ - Release amd64 (20110720.1)]/ lucid main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid main restricted
deb-src http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-updates main restricted
deb-src http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid universe
deb-src http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid universe
deb http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-updates universe
deb-src http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid multiverse
deb-src http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid multiverse
deb http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-updates multiverse
deb-src http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://tw.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
# deb-src http://tw.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu lucid partner
# deb-src http://archive.canonical.com/ubuntu lucid partner

deb http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-security main restricted
deb-src http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-security main restricted
deb http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-security universe
deb-src http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-security universe
deb http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-security multiverse
deb-src http://ubuntu.cs.nctu.edu.tw/ubuntu/ lucid-security multiverse
deb http://archive.canonical.com/ lucid partner
deb http://archive.canonical.com/ lucid partner

ubuntu firefox 手動升級

最近身邊有個 Ubuntu 新手

剛剛教他如何手動更新 firefox (因為自動更新無法正常運作,好似是權限問題)
『後來發現,好像只要用 root 權限開啟 firefox 的話,自動更新就可以正常運作了』
『sudo firefox,這樣就可以用 root 權限開啟火狐囉!』

基本上就三行搞定吧

先把下載下來的 firefox-3.6.8.tar.bz2 解壓縮
然後放到 /usr/bin 底下
刪除原本的 /usr/bin/firefox
建立一個新的 /usr/bin/firefox 連結到 /usr/bin/firefox-3.6.8/firefox
這樣就搞定了!
>bzip2 -d firefox-3.6.8.tar.bz2
>tar xf firefox-3.6.8.tar
>sudo mv firefox /usr/bin/firefox-3.6.8
>sudo rm /usr/bin/firefox
>sudo ln -s /usr/bin/firefox-3.6.8/firefox /usr/bin/firefox