GB | BIG5
|
| 首頁 > 編程技術 > C/C++ > 正文 |
 |
| Unix編程/應用問答中文版 ---1.系統管理配置問題 |
| 本文出自:http://www.nsfocus.com 維護:小四 (2002-10-17 06:02:00) |
1. 系統管理配置問題
1.1 如何給SUN工作站增加eeprom硬件口令保護
1.2 如何增加交換空間
1.3 為什我不能在/home目錄下創建子目錄
1.4 如何改變一台主機的locale
1.5 Solaris 7自動注銷
1.6 一個目錄擁有setgid設置,怎理解
1.7 非Sun Console上有無等價Stop-A的按鍵
1.8 如何讓一個用戶只能ftp而無法telnet
1.9
1.10 為什Sun工作站非要輸入boot命令才能啟動
1.11 如何讓Solaris識別新增加的硬件
1.12
--------------------------------------------------------------------------
1. 系統管理配置問題
1.1 如何給SUN工作站增加eeprom硬件口令保護
A: scz <scz@nsfocus.com>
man -s 1M eeprom了解細節,要求當前是root身份
# /usr/sbin/eeprom (顯示當前eeprom配置)
# /usr/sbin/eeprom security-mode=full ( 可選的有command, full, none)
此時進入交互式設置口令過程,總共輸入兩次,如果兩次口令輸入不一致,則本次設
置作廢。成功設置之除了go命令之外的其他ok狀態下命令均需要口令,包括boot命
令。
設置成command時,同樣進入交互式口令輸入過程。此時,除了boot和go命令之外的
其他ok狀態下命令均需要口令。注意,如果僅僅輸入boot命令,不需要口令,一旦
boot命令面帶了參數,比如boot cdrom -s,同樣需要輸入口令。
如果設置成none(缺省設置),表示去掉這種口令保護。
# /usr/sbin/eeprom security-password= (等號面無其他字符,直接回車)
如果想改變前面設置的口令,用這條命令,同樣是交互式輸入過程。
# /usr/sbin/eeprom security-#badlogins=3 (缺省是0)
設置口令輸入嘗試次數。
警告:如果設置了eeprom硬件保護口令而又忘記,會帶來很多麻煩,務必小心。
一個可行的設置辦法是,安全模式設置到command而不是full,這樣至少可以正常啟
動系統。是只要記得root口令或者還有其他機會獲得root權限(緩沖區溢出?),就
可以通過設置安全模式為none而挽救回來。
但是如果設置成full模式卻忘記了eeprom口令,我想首先應該打電話給SUN的技術支
持。如果出某種理由你不想這樣做,我不確認eeprom是否可以熱插拔,先用一個無
口令保護的eeprom啟動系統,然熱插拔換上那個有口令保護的eeprom,然用root
權限抹去eeprom口令。
1.2 如何增加交換空間
A: WT <wt@server.domain.top>
你無法改變分區大小,但是可以增加/刪除交換文件,效果類似交換分區。下列命令
在根目錄下創建一個500MB的交換文件,名為swapfile
# mkfile 500m /swapfile
下列命令將使之生效
# swap -a /swapfile
現在你有了額外的500MB交換空間,為了每次重啟依舊有效,編輯/etc/vfstab文件
增加如下行
/swapfile - - swap - no -
# swap -l
這裡"-l"意味著"list",顯示所有交換空間。仔細閱讀"swap"和"mkfile"的手冊頁。
1.3 為什我不能在/home目錄下創建子目錄
Q: Solaris 7下,root身份,當我試圖在/home目錄下創建子目錄時,系統拒絕,為
什?
A: mohansundarraj
如果/etc/rc2.d/S74autofs腳本中automount(1M)守護進程已經mount了/home,就是
這種現象,而這還是缺省安裝的情形。可以
# /etc/init.d/autofs stop
# umount /home
然你就可以用root身份在/home下創建子目錄,增加文件了。為了永久取消autofs
特性,可以將/etc/rc2.d/S74autofs腳本改名,並注釋掉/etc/auto_home、
/etc/auto_master兩個文件中的入口點。
SPARC/Solaris的缺省用戶主目錄是/export/home,而不是/home。
1.4 如何改變一台主機的locale
Q: 一台SPARC/Solaris 8運行在US locale環境中,現在我們想讓它運行在
IE(Ireland) locale環境中,以便可以使用歐洲日期格式,怎辦?
A: Sharad Ramachandran <estancio@hotmail.com>
運行sys-unconfig,在此之前請man -s 1M sys-unconfig,:-)
A: chad schrock <chad@radix.net>
天啊,為了拍死一只蒼蠅,你要引爆原子彈嗎?
只需要做如下操作,在你的.cshrc/.profile/.bashrc等啟動腳本中設置$LANG環境變
量的值為en_UK,注銷,重新登錄即可。為了使這個設置全局有效,修改
/etc/default/init文件,LANG=en_UK,重啟動。
--------------------------------------------------------------------------
# @(#)init.dfl 1.2 92/11/26
#
# This file is /etc/default/init. /etc/TIMEZONE is a symlink to this file.
# This file looks like a shell script, but it is not. To maintain
# compatibility with old versions of /etc/TIMEZONE, some shell constructs
# (i.e., export commands) are allowed in this file, but are ignored.
#
# Lines of this file should be of the form VAR=value, where VAR is one of
# TZ, LANG, or any of the LC_* environment variables.
#
TZ=GMT+8
LANG=zh.GBK
--------------------------------------------------------------------------
參看locale(1)和locale(5),了解更多關locale的信息。運行"locale -a",查看
當前系統所支持的所有locale。
A: Sun Microsystems 2001-06-12
有三種方式改變locale。首先用"locale -a"命令確認系統中已安裝的locale
1) 從CDE登錄屏幕上修改locale
選擇 options -> languages -> choose the new locale
注意,如果登錄用戶的初始化文件中有不同的locale設置,將優先系統全局locale
設置。
2) 臨時設置locale(shell相關的)
ksh : LANG=<locale>
sh : LANG=<locale>
export LANG
csh : setenv LANG <locale>
bash: export LANG=en_US(zh.GBK)
3) vi /etc/default/init
增加如下內容
LANG=<locale>
LC_ALL=<locale>
重啟系統。
運行"locale"命令確認改變生效。
如果你希望使用的locale並未安裝,參看如下文檔安裝locale
Solaris 8 : <<International Language Environments Guide>>
Solaris 7 : <<Solaris Internationalization Guide For Developers>>
Solaris 2.6: <<Solaris Internationalization Guide for Developers>>
D: scz <scz@nsfocus.com> 1998-08
SPARC/Solaris 2.5下,為了在vi中正確看到中文需要設置環境變量
sh
LANG=C;export LANG
LC_CTYPE=iso_8859_1;export LC_CTYPE
csh
setenv LANG zh
關設置LANG這個環境變量涉及到/usr/lib/locale下的目錄權限。
1.5 Solaris 7自動注銷
Q: 怎樣設置才能30秒自動注銷
A: shridhara
不幸的是,Solaris對此沒有什好的支持。如果正在使用telnet會話,或許可以考
慮"logout"變量,參看telnet的手冊頁。一個變通的辦法,使用K-Shell,它支持
TMOUT變量,用指定非活動時限(以秒為單位)。比如,如果一個shell會話3分鐘內
不活動,則終止這個shell會話
$ TMOUT=180;export TMOUT
可以在用戶的.profile文件中放置該行。缺點是你只能使用ksh。
D: scz <scz@nsfocus.com>
vi /etc/default/login
# TIMEOUT sets the number of seconds (between 0 and 900) to wait before
# abandoning a login session.
#
TIMEOUT=180
這裡的超時設置針對登錄過程,而不是登錄成功的shell會話超時設置。
1.6 一個目錄擁有setgid設置,怎理解
Q: 對一個目錄做了setgid設置,可我並沒有發現這和正常情況有什區別
A: John Riddoch <jr@scms.rgu.ac.uk>
在這種目錄下創建新文件時將採用setgid設置對應的屬組,比如
$ ls -ld b
drwxrws--- 2 jr group 512 Mar 14 17:13 b/
$ touch b/a
$ ls -l b/a
-rw------- 1 jr group 0 Mar 14 17:13 b/a
$ id
uid=178(jr) gid=10(staff)
jr的缺省組是staff,而現在b/a文件屬組是group。
D: 小四 <scz@nsfocus.com>
SPARC/Solaris 7下測試
如果目錄擁有SGID設置,那該目錄下新創建的文件將繼承該目錄的屬組,而不是創
建者所對應的GID。
[root@ /export/home/scz]> id
uid=0(root) gid=1(other) <-- 注意當前用戶的屬組
[root@ /export/home/scz]> mkdir groupsgid
[root@ /export/home/scz]> ls -ld groupsgid
drwxr-xr-x root other groupsgid/
[root@ /export/home/scz]> chown scz:users groupsgid
[root@ /export/home/scz]> chmod g+s groupsgid
[root@ /export/home/scz]> ls -ld groupsgid
drwxr-sr-x scz users groupsgid/ <-- 目錄擁有SGID設置
[root@ /export/home/scz]> cd groupsgid/
[root@ /export/home/scz/groupsgid]> touch scz_0
[root@ /export/home/scz/groupsgid]> ls -l scz_0
-rw-r--r-- root users scz_0 <-- 注意屬組變化
[root@ /export/home/scz/groupsgid]> chmod g-s ../groupsgid/
[root@ /export/home/scz/groupsgid]> ls -ld ../groupsgid/
drwxr-xr-x scz users ../groupsgid/
[root@ /export/home/scz/groupsgid]> touch scz_1
[root@ /export/home/scz/groupsgid]> ls -l scz_1
-rw-r--r-- root other scz_1 <-- 注意屬組變化
[root@ /export/home/scz/groupsgid]>
1.7 非Sun Console上有無等價Stop-A的按鍵
A: neomilev
如果是便攜機,嘗試alt/break 或者 ctrl/break。如果是vt100終端,嘗試F11 或者
break
1.8 如何讓一個用戶只能ftp而無法telnet
A: 小四 <cloudsky@263.net>
修改該用戶在/etc/passwd中的shell為/bin/false,在/etc/shells文件中增加
/bin/false,此時,該用戶只能ftp,telnet失敗。
1.10 為什Sun工作站非要輸入boot命令才能啟動
Q: 我有台Sun工作站,每次開機停在ok狀態下,需要手工輸入boot命令才能啟動,
現在想避免這種效果,怎辦
A: /usr/sbin/eeprom auto-boot?=true
/usr/sbin/eeprom auto-boot? <-- 查詢
A: dengdai@SMTH
進入OBP狀態
ok setenv auto-boot? true
ok setenv boot-device disk
反之
ok setenv auto-boot? false
1.11 如何讓Solaris識別新增加的硬件
Q: 比如新增加了網卡、硬盤、光驅什的,如何讓Solaris意識到這種增加
A: spp(低音炮) & suxm <suxm@gnuchina.org>
有三種辦法
a. Stop-A進入OBP狀態,輸入boot -r
b. sync(重復);reboot -- -r
c. touch /reconfigure;sync(重復);reboot
參看reboot(1M)、boot(1M)、eeprom(1M)、kernel(1M)、cfgadm(1M)、psradm(1M)手
冊頁
Q: 我新增加了一塊硬盤,不想boot -r而立即生效,怎辦
A: 老大 <willxu@public.cs.hn.cn> 2001-12-04 16:51
直接將第二塊硬盤接上去,然順序執行如下命令,不用重新啟動機器
modunload -i 0
drvconfig(1M)
devlinks(1M)
disks(1M)
如果需要重新格式化、分區、創建文件系統,就繼續執行
format(1M)
newfs(1M)
(http://www.fanqiang.com)
進入【UNIX論壇】
|
|
| 相關文章 |
Unix編程/應用問答中文版 ---0.簡介 Unix/C傳奇問題 (2002-10-16 06:02:01)
|
|
|
|
 |
★ 樊強制作 歡迎分享 ★ |