文件查找
which whereis locate find
--which
which - shows the full path of (shell) commands.
[root@li ~]# which mount
/bin/mount
[root@li ~]# rpm -qf `which ls` --有別名
--color=tty': unknown option
[root@li ~]# rpm -qf `which --skip-alias ls`
coreutils-5.97-23.el5
[root@li ~]# which ifconfig --查找二進位可執行文件,通過環境變數來查找 也就是$PATH的路徑來查找.
/sbin/ifconfig
[a@li ~]$ which ifconifg --普通用戶環境變數沒有/sbin/這個路徑,所以which找不到
/usr/bin/which: no ifconifg in (/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/a/bin)
--whereis
whereis - locate the binary, source, and manual page files for a command
[root@li ~]# whereis ifconfig
ifconfig: /sbin/ifconfig /usr/share/man/man8/ifconfig.8.gz
[a@li ~]$ whereis ifconfig
ifconfig: /sbin/ifconfig /usr/share/man/man8/ifconfig.8.gz
--locate
locate - find files by name
[root@li ~]# locate rhel-5.4
/share/soft/iso/rhel-5.4-server-i386-dvd.iso
速度快,通過系統帶的一個資料庫去查找
[root@li ~]# ls /var/lib/mlocate/
mlocate.db
[root@li ~]# ll /var/lib/mlocate/mlocate.db -h
-rw-r----- 1 root slocate 4.6G Jul 6 11:02 /var/lib/mlocate/mlocate.db
--我這裡看到這個文件有近5G,太大了,一般都在幾M大小;我這台機器先前寫腳本建立過大量文件
[root@li ~]# touch abcd777 --新建一個文件
[root@li ~]# locate abcd777 --locate查找不出來
[root@li ~]# updatedb --手動更新locate資料庫,時間比較長,但是系統的時間任務服務會在晚上4點幫你去更新
[root@li ~]# locate abcd777 --更新locate資料庫后,再查找就有了
find
find - search for files in a directory hierarchy
速度慢,要掃你的磁碟,功能強大
find 路徑 [選項]
-name --通過名字找
-type --通過文件類型找
-uid --通過uid查找
-gid --通過gid查找
-user --通過username查找
-group --通過groupname查找
-perm --通過許可權查找
n --n包含的許可權也查找出來
-n --包含n的許可權也查找出來
-size --通過大小查找
+n --查出大於n的文件
-n --查出小於n的文件
1,按名稱查找
[root@li ~]# find /etc/ -name grub.conf --要全名,與locate不同,不是匹配名字
/etc/grub.conf
[root@li ~]# find /etc/ -name grub
/etc/sysconfig/grub
[root@li ~]# find /etc/ -name grub* --名字不太確定,可以用*通配符來代替
/etc/sysconfig/grub
/etc/grub.conf
find /test/ -iname Aaa --忽略大小寫加上-i
/test/aaa
/test/Aaa
/test/AAa
[root@dns test]# find /test/ -name adobe*
[root@dns test]# find /test/ -iname adobe*
/test/AdobeReader_chs-7.0.0-2.i386.rpm
--定義查找的目錄層次
[root@li a]# find /test/ -maxdepth 1 -name aaa
/test/aaa
[root@li a]# find /test/ -maxdepth 2 -name aaa
/test/aaa
/test/a/aaa
[root@dns test]# find / -maxdepth 1 -name grub.conf
[root@dns test]# find / -maxdepth 2 -name grub.conf
/etc/grub.conf
/test/grub.conf
[root@dns test]# find / -maxdepth 3 -name grub.conf
/etc/grub.conf
/boot/grub/grub.conf
/test/grub.conf
[root@li test]# find / -mindepth 3 -maxdepth 3 -name grub.conf
/boot/grub/grub.conf
2,按類型查找
find /etc -type l |grep grub.conf
find /etc -type l -name grub.conf --與-name參數一起寫
find / -type b
find / -type s
find / -type c
find / -type p
find /test -type d |xargs chmod 777
find /test -type d -exec chmod 755 {} \;
3,按用戶名,組名,uid,gid查找
find / -user a
find / -group a
find / -uid 533
find / -gid 533
find / -nouser --查出系統的無頭文件,就是指沒有屬主的文件
find / -nogroup --查出系統的沒有屬組的文件
沒有屬主和屬組的文件,系統管理一般是要去注意的
[root@dns test]# find /test -user a |xargs tar cf /backup/c.tar
4,按許可權查找
find / -perm 777 --查出所有許可權為777的文件,一般也是管理員要注意的
find . -perm 111 ---相當於或的功能
find . -perm -777 ---相當於與的功能
[root@li test]# ll
total 0
-rwxrwxrwx 1 root root 0 Mar 16 13:38 1
-rwxr-xr-- 1 root root 0 Mar 16 13:38 2
-r-xr-x-w- 1 root root 0 Mar 16 13:38 3
-r-x------ 1 root root 0 Mar 16 13:38 4
-r--r----x 1 root root 0 Mar 16 13:38 5
--w-r--r-x 1 root root 0 Mar 16 13:38 6
---x-w--wx 1 root root 0 Mar 16 13:38 7
---------- 1 root root 0 Mar 16 13:38 8
[root@li test]# find . -perm 001 --文件的許可權與 號后的許可權只要有一位重合,就找出來
.
./6
./5
./1
./7
--find . -perm /001 --和 號一樣,用來取代 號
[root@li test]# find . -perm -400 --文件的許可權要包含-號后的許可權(也就是都重合)就找出來
.
./3
./5
./1
./2
./4
練習: 查找/etc/下所有隻要user1用戶可讀可寫的文件
find /etc/ -perm -006
5,按大小查找
find / -size 500M --單位有k,m,g等
find / -size 1G
find /etc -size 50k
find /etc -size 50b --b是塊,一個塊是512個位元組
find / -size -1M
--查找大於80M小於100M的文件
find /share -size 80M -size -100M -type f
6,按時間查找
[root@li a]# stat 1
File: `1'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 808h/2056d Inode: 12177882 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2010-04-24 14:44:00.000000000 0800 --atime 閱讀過,用cat,tail,head命令等或者vi訪問過,但沒有修改;執行過也會改變
Modify: 2010-04-24 14:44:00.000000000 0800 --mtime 修改過內容,用vi修改過或者echo一個值重定向
Change: 2010-04-24 14:44:14.000000000 0800 --ctime 改變過內容,屬主,屬組,許可權,創建軟鏈接,硬鏈接,重命名等
find 按時間查找有 atime,mtime,ctime,amin,mmin,cmin等
-mtime n --代表n天前的24小時內
n --代表n天前(不包含n天本身的24小時)
-n --代表n天內
find . -atime 1 --表示從現在起往前推24小時到推48小時之間的24小時
find . -atime 1 --表示從現在起前推48小時之前的所有時間
find . -atime -1 --表示從現在起往前推24小時到將來的所有時間
1 2 3 4 5 6 7
|-- 2 --|
<------- -2="" 2="" ---------------="">
將來 now 以前的時間
find / -mtime 0 --0代表目前當天的24小時
find / -mtime 1 --修改時間1天之前
find . -mtime -1 --修改時間在一天之內
練習:
比如現在為7號凌晨0點
查找/etc/下5號那天修改過內容的文件
find /etc -mtime 1
查找/ 下2號以前修改過許可權的可能文件
find / -ctime 4
查找 / 下6號到現在被訪問過的文件
find / -atime 0
查找10分鐘內訪問過的文件
find / -amin -10
現在為下午11:30 查找上午10點之後修改過內容的文件
find / -mmin -90
-----------------------------
find後接-exec動作
-exec
find /etc/ -name "*.conf" -exec cp {} /test/a \;
find /etc/ -name grub -exec cat {} \;
-- -exec後面接動作, {}代表前面的結果集 \; 代表結束
==================================
=======================================
quota - display disk usage and limits
磁碟配額
可以以用戶來配額,也可以以組來配額
應用的場景:
web伺服器 對web空間進行限制
郵件伺服器 對用戶的郵件空間進行限制
文件伺服器 對用戶的文件共享空間進行限制
VPS 虛擬私有主機 virtual private server
把一台強勁的服務使用虛擬化技術虛擬成多台小的伺服器,然後租用給用戶使用
quota的使用限制:
1,它只能對分區有效
2,內核要支持quota --但掛載時要使用特殊參數
3,只能針對普通用戶,不能限制root用戶
quota的限制方式:
1,block 對磁碟空間大小來做限制,最常用
--第一步:
先分一個區出來做測試:
fdisk /dev/sda
Command (m for help): n --新建一個分區
First cylinder (21848-38913, default 21848):
Using default value 21848
Last cylinder or size or sizeM or sizeK (21848-22195, default 22195): 1000M --指定分區為1000M大小
Using default value 22195
Command (m for help): w --保存並退出
[root@li /]# partprobe --將剛分區的信息刷新到磁碟分區表
[root@li /]# mkfs.ext3 /dev/sda13 --格式化剛分的分區
--第二步:
掛載剛分的區,注意掛載參數
[root@li /]# mount -t ext3 -o usrquota,grpquota /dev/sda13 /quota/ --usrquota指支持以用戶來配額,grpquota指支持以組來配額
[root@li /]# mount
/dev/sda13 on /quota type ext3 (rw,usrquota,grpquota) --用mount命令驗證掛載參數
要想永久生效:
寫到/etc/fstab
/dev/sda13 /quota ext3 defaults,usrquota,grpquota 0 0
--第三步:
對要使用quota功能的分區生成quota配置文件
命令為quotacheck
quotacheck - scan a filesystem for disk usage, create, check and repair
quota files
[root@li /]# cd /quota/
[root@li quota]# ls
lost found
quotacheck -cauvg
-c 忽略已經原有的配置文件並再次生成
-a 掃描所有使用掛載參數掛載的分區,並對他們生成配置文件
-u 生成與用戶配額有關的配置文件
-g 生成與組配額有關的配置文件
-v 可以看到生成配置過程信息
[root@li quota]# quotacheck -cauvg --對啟用quota的分區生成配置文件
quotacheck: Scanning /dev/sda13 [/quota] quotacheck: Cannot stat old user quota file: No such file or directory
[root@li quota]# ls --再次列表查看,會發現多了兩個配置文件
aquota.group aquota.user lost found
--第四步:
開始對用戶使用配額
edquota - edit user quotas
[root@li ~]# id a
uid=522(a) gid=522(a) groups=522(a)
[root@li ~]# id b
uid=523(b) gid=523(b) groups=523(b)
[root@li quota]# edquota -u a
Disk quotas for user a (uid 533):
Filesystem blocks soft hard inodes soft hard
/dev/sda13 0 20000 30000 0 0 0
--軟限制為20M ,硬限制為30m inode不好控制,不建議使用
[root@li quota]# edquota -u b
Disk quotas for user a (uid 533):
Filesystem blocks soft hard inodes soft hard
/dev/sda13 0 40000 50000 0 0 0
--第五步:
啟用quota功能
quotaon /dev/sda13
-第六步:
查看配額的使用情況:
[root@li quota]# repquota -a
*** Report for user quotas on device /dev/sda13
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
[root@li quota]# repquota -avugs --查看更詳細的磁碟配額
-a 直接搜索有quota標誌的分區,報告quota的結果
-v 顯示詳細信息
-u 顯示使用者的quota值
-g 顯示組的quota值
-s Try to report used space, number of used inodes and limits in
more appropriate units than the default ones.
*** Report for user quotas on device /dev/sda13
Block grace time: 7days; Inode grace time: 7days --grace time指的是寬限時間,默認是7天
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 69712 0 0 4 0 0
a -- 0 20000 30000 0 0 0
b -- 0 40000 50000 0 0 0
Statistics:
Total blocks: 7
Data blocks: 1
Entries: 3
Used average: 3.000000
*** Report for group quotas on device /dev/sda13
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
Group used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 69712 0 0 4 0 0
Statistics:
Total blocks: 6
Data blocks: 1
Entries: 1
Used average: 1.000000
下面使用a用戶測試:
[root@li ~]# su - a
[a@li quota]$ dd if=/dev/zero of=/quota/a1 bs=1M count=19 --創建一個19M的文件a1,沒有警告
19 0 records in
19 0 records out
[a@li quota]$ dd if=/dev/zero of=/quota/a2 bs=1M count=2 --再創建一個2M的文件a2,19+2大於對a用戶的軟體限制20M,所以報警告
sda13: warning, user block quota exceeded.
2 0 records in
2 0 records out
2097152 bytes (2.1 MB) copied, 0.00702628 seconds, 298 MB/s
[a@li quota]$ dd if=/dev/zero of=/quota/a3 bs=1M count=8 --創建8M的文件a3,還沒超過硬限制
[a@li quota]$ dd if=/dev/zero of=/quota/a4 bs=1M count=2 --創建2M的文件a4,超過硬限制,失敗
sda13: write failed, user block limit reached.
dd: writing `/quota/a4': Disk quota exceeded
1 0 records in
0 0 records out
266240 bytes (266 kB) copied, 0.00137422 seconds, 194 MB/s
b用戶測試方式也一樣
===========================================================
root用戶查看測試后的情況:
[root@li quota]# repquota -a
*** Report for user quotas on device /dev/sda13
Block grace time: 10days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 69712 0 0 4 0 0
a - 30000 20000 30000 9days 5 0 0
b - 50000 40000 50000 9days 2 0 0
--上面的實驗可以針對grace time來測試一下,
[user2@li ~]$ dd if=/dev/zero of=/quota/user2.01 bs=1M count=29
29 0 records in
29 0 records out
30408704 bytes (30 MB) copied, 0.0526351 seconds, 578 MB/s
[user2@li ~]$ dd if=/dev/zero of=/quota/user2.02 bs=1M count=2
--上面達到了軟限制,在這裡我把系統時間改到7天之後
[user2@li ~]$ dd if=/dev/zero of=/quota/user2.03 bs=1M count=2
sda7: write failed, user block quota exceeded too long.
dd: writing `/quota/user2.03': Disk quota exceeded
1 0 records in
0 0 records out
0 bytes (0 B) copied, 0.00022272 seconds, 0.0 kB/s
--系統時間在7天之後(也就是grace time),按理來說硬限制還沒有達到,仍然可以寫8M到9M的大小,但是現在一個位元組都寫不進去 --->這就是grace time的作用
[root@li test]# edquota -t --修改grace time的方法
==================================
嘗試使用inode來限制
[root@li test]# edquota -u a
Disk quotas for user a (uid 520):
Filesystem blocks soft hard inodes soft hard
/dev/sda8 0 20000 30000 0 2 5
[root@li src]# su - a
[a@li ~]$ cd /quota/
[a@li quota]$ touch a1
[a@li quota]$ touch a2
[a@li quota]$ touch a3
sda8: warning, user file quota exceeded.
[a@li quota]$ touch a4
[a@li quota]$ touch a5
[a@li quota]$ touch a6
sda8: write failed, user file limit reached.
touch: cannot touch `a6': Disk quota exceeded
==================================
-----------------------------------------------------------
組quota配置
要使用組quota配置,掛載時要加上grpquota的參數
usermod -g quota a
2,編輯組quota時
edquota -g quota
3,測試的時候,
對quota組的限制要以組員a和b創建文件佔用大小的總和的計算
[root@li quota]# groupadd quota
[root@li quota]# useradd -g quota aa
[root@li quota]# useradd -g quota bb
[root@li quota]# id aa
uid=537(aa) gid=538(quota) groups=538(quota)
[root@li quota]# id bb
uid=538(bb) gid=538(quota) groups=538(quota)
[root@li quota]# repquota -avgs
*** Report for group quotas on device /dev/sda13
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
Group used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 69712 0 0 4 0 0
a -- 30000 0 0 5 0 0
b -- 50000 0 0 2 0 0
quota -- 0 30000 40000 0 0 0
Statistics:
Total blocks: 7
Data blocks: 1
Entries: 4
Used average: 4.000000
[aa@li ~]$ dd if=/dev/zero of=/quota/aa1 bs=1M count=10
10 0 records in
10 0 records out
10485760 bytes (10 MB) copied, 0.0339249 seconds, 309 MB/s
[bb@li ~]$ dd if=/dev/zero of=/quota/bb1 bs=1M count=21
sda13: warning, group block quota exceeded.
21 0 records in
21 0 records out
22020096 bytes (22 MB) copied, 0.0730932 seconds, 301 MB/s
[aa@li ~]$ dd if=/dev/zero of=/quota/aa2 bs=1M count=10
問:當用戶配額和組配額都配置了的時候,有衝突的話,那麼是哪個生效?還是都生效?
全部生效,先到達限制的就生效;如果還配置了inode的方式,也一樣是都生效的
=============================================================
=============================================================
ACL access control list 訪問控制列表
內核級別上去實現的
創建一個文件 test ,要求 user1用戶對它有讀寫執行,user2,user3,user4用戶對它有讀和執行,其它用戶對它只讀
-rwxr-xr-- user1 group1 test
--把user2,user3,user4都加入到group1這個組
--上面的針對同一個文件或者目錄有三類不同的許可權需求,是可以表示出來的;如果有四類或者四類以上的許可權需求,就不能表示,那麼ACL就可以用上了
acl access control list 訪問控制列表
針對同一個文件,對不同的用戶實現不同的許可權設置,它是內核級別實現許可權控制
--要注意的:在rhel5.1,5.2版本是不能直接支持,需要掛載時加上acl參數 -o acl
[root@li test]# dumpe2fs /dev/sda8 |grep user_xattr
dumpe2fs 1.39 (29-May-2006)
Default mount options: user_xattr acl --這裡有acl表示是支持acl
mount -t ext3 -o defaults,usrquota,grpquota,acl /dev/sda7 /quota
setfacl 設置acl命令 --對文件和目錄都可以
getfacl 查看acl許可權狀態
setfacl - set file access control lists
EXAMPLES --man幫助文檔中的例子
Granting an additional user read access
setfacl -m u:lisa:r file
Revoking write access from all groups and all named
users (using the effective rights mask)
setfacl -m m::rx file
Removing a named group entry from a file’s ACL
setfacl -x g:staff file
setfacl
-m 設置acl
-x 與-m相反
-b 清空文件所有設置的acl
練習:
針對test文件,user1對其rwx,user2對其rw,user3對其rx
setfacl -m u:user1:rwx test
setfacl -m u:user2:rw test
setfacl -m u:user3:rx test
[root@li test]# ll |grep test
-rw-r--r-- 1 root root 0 Apr 18 16:05 test
[root@li test]# getfacl test
# file: test
# owner: root
# group: root
user::rw-
group::r--
other::r--
[root@li test]# setfacl -m u:a:rwx test --設置a用戶對test文件的許可權為rwx
[root@li test]# ll |grep test --用ll查看時發現有一個 號,許可權有點不一樣,表明有acl在起作用
-rw-rwxr-- 1 root root 0 Apr 18 16:05 test
[root@li test]# getfacl test
# file: test --指文件名
# owner: root --指文件的屬主
# group: root --指文件的屬組
user::rw- --指的是屬主對此文件的許可權
user:a:rwx --指的是a用戶對此文件的許可權
group::r-- --指的是屬組對此文件的許可權
mask::rwx --指的是一個有效位,做一個與運算
other::r-- --指的others對此文件的許可權
[root@li test]# setfacl -m u:b:r test
[root@li test]# setfacl -m u:c:rx test
[root@li test]# setfacl -m u:d:wx test
[root@li test]# getfacl test
[root@li test]# setfacl -m g:quota:rwx test --設置quota組對test文件的許可權為rwx
[root@li test]# getfacl test
# file: test
# owner: root
# group: root
user::rw-
user:a:rwx
user:b:r--
user:c:r-x
user:d:-wx
group::r--
group:quota:rwx
mask::rwx
other::r--
[root@li test]# setfacl -m o:x test --對others對test文件的許可權為x
[root@li test]# getfacl test
# file: test
# owner: root
# group: root
user::rw-
user:a:rwx
user:b:r--
user:c:r-x
user:d:-wx
group::r--
group:quota:rwx
mask::rwx
other::--x
--驗證時要注意,只有x許可權還是不能執行的,讀取不了內容,就算有X許可權也不可以.所以rx都要有,才能執行
[root@li test]# setfacl -m mask:r test --對test文件的mask值設為r
[root@li test]# getfacl test
# file: test
# owner: root
# group: root
user::rw-
user:a:rwx #effective:r--
user:b:r--
user:c:r-x #effective:r--
user:d:-wx #effective:---
group::r--
group:quota:rwx #effective:r--
mask::r--
other::--x --mask對other無效
[root@li test]# setfacl -b test
[root@li test]# getfacl test
# file: test
# owner: root
# group: root
user::rw-
group::r--
other::--x
[root@li test]# setfacl -m u:a:rw,g:b:rwx,o:r,mask:rwx test --一次設置多個acl
[root@li test]# getfacl test
取消用戶的acl規則:
setfacl -x u:user1 test
取消所有的acl規則:
setfacl -b test
--如果一個用戶同屬於兩個組,使用acl定義的這兩個組一個有rw許可權,另一個有x許可權,那麼此用戶會對其有rwx許可權;
acl可以對目錄生效,設置方法一樣
練習:
一,創建一個/acl目錄,
現在有user1,user2,user3,user4,user5五個用戶
要求:
user1能在此目錄下創建文件,能CD進去,別的都不能
user2能列出目錄內容,能CD進去,別的都不能
user3,user4同屬於group1,group1組的用戶對此目錄有任意許可權
user5用戶只能CD進去
先使用acl參數來掛載一個分區到/acl目錄讓它支持quota
groupadd group1
useradd user1
useradd user2
useradd -G group1 user3
useradd -G group1 user4
useradd user5
setfacl -m u:user1:wx /acl
setfacl -m u:user2:rx /acl
setfacl -m g:group1:rwx /acl
setfacl -m u:user5:x /acl
============================================================
vnc
Summary : A remote display system.
Description :
Virtual Network Computing (VNC) is a remote display system which
allows you to view a computing 'desktop' environment not only on the
machine where it is running, but from anywhere on the Internet and
from a wide variety of machine architectures. This package contains a
client which will allow you to connect to other desktops running a VNC
server.
VNC (虛擬網路計算)virtual network computing
屬於一種遠程控制軟體
主要分vncserver vncviewer
[root@li a]# yum list |grep vnc
This system is not registered with RHN.
RHN support will be disabled.
vnc.i386 4.1.2-14.el5_3.1 installed --客戶端
vnc-server.i386 4.1.2-14.el5_3.1 installed --服務端
客戶端先裝上vnc.i386這個包
yum install vnc 裝完后就會有vncviewer這個命令
[root@li ~]# vncserver
You will require a password to access your desktops.
Password:
Verify:
New 'li.cluster.com:1 (root)' desktop is li.cluster.com:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/li.cluster.com:1.log
[root@li ~]# vncviewer 10.1.1.35:1 --注意後面這個 :1
--默認連接的桌面叫做twm,一種最簡單的桌面環境
--------------
讓客戶端實現連接上的不是twm這個簡單桌面,而是gnome
/root/.vnc/ --配置目錄
vim /root/.vnc/xstartup --要顯示gnome-session 就把下面兩句打開,再把別的都給註釋掉
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
#[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
#vncconfig -iconic &
#xterm -geometry 80x24 10 10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
修改完配置文件后,再在服務端使用vncserver開啟一個連接,用客戶端來連接這個新連接就可以控制server端的gnome桌面了
[root@li ~]# vncserver :99 --一般數字是按照順序來的,但也可以這樣指定,直接開啟第99號控制窗口
[root@li ~]# vncpasswd
[root@li a]# ls /root/.vnc/
li.cluster.com:1.log li.cluster.com:2.log li.cluster.com:3.log passwd
li.cluster.com:1.pid li.cluster.com:2.pid li.cluster.com:3.pid xstartup
[root@li a]# vncserver -kill :1 --殺掉1號控制窗口
Killing Xvnc process ID 11889
[root@li a]# ls /root/.vnc/
li.cluster.com:1.log li.cluster.com:2.pid li.cluster.com:3.pid xstartup
li.cluster.com:2.log li.cluster.com:3.log passwd
[root@li a]# netstat -ntl |grep 58
tcp 0 0 0.0.0.0:5802 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5803 0.0.0.0:* LISTEN
vnc的埠是5801開始和5901開始
5800 n 是給瀏覽器用的 5900+n 是給vncviewer用的
http://10.1.1.35:5802/ --用瀏覽器訪問
但linux下的firefox瀏覽器是要裝一個java插件
實現大家都可以連接上來,並且是只讀模式
vncviewer -Viewonly -Shared 10.1.1.35:1 --這種也不太用
服務端可以使用下面的命令來控制
[root@li ~]# vino-preferences
客戶端使用:
vncviewer 10.1.1.35:0 連接就可以了
本文出自 「linuxart」 博客,請務必保留此出處http://linuxart.blog.51cto.com/686203/843938
[火星人 ] linux09-查找,quota,acl已經有744次圍觀