請問如何偵測使用者登入在本機? - Linux

Zora avatar
By Zora
at 2008-08-18T12:35

Table of Contents

※ 引述《StringR (MoO~)》之銘言:
: 請問一下,如何得知使用者是在本機上登入,而不是遠端連進去的?
: 目前要在login script中寫一些系統環境設定變更的參數,但是只想在使用者是在本機
: 登入的時候才執行,遠端telnet、rlogin、XDMCP之類的登入都不要做變更。
: 麻煩指導一下,謝謝!

# local post
# 我猜你想做 autologin 之類的
# tty 看是第幾個
# 如果是 tty 就可以了,那可以用 bash 的字串處理抓前八個 char:
# "${TTY:0:8}" = "/dev/tty"

TTY=`/usr/bin/tty`

if [ "$TTY" = "/dev/tty1" ];
then
## startx -- :0
fi


--

人不作出犧牲,便得不到任何收穫;如果要得到某種東西,就必須付出同等代價。這一點
,就是鍊金術的基本原則 ── 等價交換。當時我們深信這一點就是世界的真理。

阿爾風斯‧愛力克,《鋼之鍊金術師》開場白

--
Tags: Linux

All Comments

Re: 安裝顯示卡驅動程式問題

Lucy avatar
By Lucy
at 2008-08-18T11:49
※ 引述《greatteacher (硬漢)》之銘言: : 我使用Ubuntu8.04 : 安裝顯卡驅動時發現以下問題 : ERROR: You appear to be running an X server; please exit X before installing. : For further d ...

UBUNTU 使用 realtek 8168c 網卡 無法上網

Ina avatar
By Ina
at 2008-08-18T11:14
ubuntu版本是7.10 kernel 2.6.22 已上官網下載最新的driver並安裝 iconfig 之後有看到 eth0 IP 相關設定之後 不能上網 RX packets 0 dropped:445453554 TX packets 0 dropped:43432 似乎封包丟不出去? ...

安裝顯示卡驅動程式問題

Rosalind avatar
By Rosalind
at 2008-08-18T11:07
我使用Ubuntu8.04 安裝顯卡驅動時發現以下問題 ERROR: You appear to be running an X server; please exit X before installing. For further details, please see the section INS ...

iptables route target 設定問題

Dorothy avatar
By Dorothy
at 2008-08-18T02:39
小弟我安裝了patch-o-matic-ng裡面所提供的 ROUTE target 目的是為了把封包導向到所指定的介面上。說明如下 The target can be or not a final target. It has to be used inside the mangle table. ...

apt-get install ,有辦法可看到軟體的版本嗎?

Lily avatar
By Lily
at 2008-08-18T01:33
我用apt-cache search搜尋軟體 有找到我要的軟體 但它沒有列出版本 有辦法在安裝前,看到軟體的版本嗎? - ...