隨筆-49  評論-67  文章-27  trackbacks-0
           

          1 .簡介

          自從 0.99.2 版本開始, pure-ftpd 就開始支持虛擬用戶。虛擬用戶方式十分類似 /etc/passwd ,將用戶的相關信息,如口令、姓名、 uid 、目錄等,存入文件。但是該文件只適用于 FTP

          這意味著,可以為 FTP 設置虛擬用戶,而不需要在系統中添加系統用戶。同時,可以為這些用戶單獨設置配額、 ratio 、帶寬等限制。很多虛擬用戶可以共享同一個系統用戶的屬性,因此建議為這些虛擬用戶單獨創建一個系統用戶,從而方便管理。

          首先,可以在系統中添加相應的用戶和組,如 ftpuser ftpgroup 。如:

          groupadd ftpgroup

          useradd -g ftpgroup -d /dev/null -s /etc ftpuser

          可以使用 ”pure-pw” 來創建虛擬用戶。虛擬用戶的信息以每個用戶一行的方式存放在相應的文件中,其格式如下所示:

          <account>:<password>:<uid>:<gid>:<gecos>:<home directory>:<upload bandwidth>:<download bandwidth>:<upload ratio>:<download ratio>:<max number of connections>:<files quota>:<size quota>:<authorized local IPs>:<refused local IPs>:<authorized client IPs>:<refused client IPs>:<time restrictions>

          其中,除了帳號、口令、 uid gid home 目錄之外,其它的可以是空值。

          2 .創建一個用戶

          接下來,我們來創建一個新的用戶。 pure-pw 的語法規范如下:

          pure-pw useradd <login> [-f <passwd file>] -u <uid> [-g <gid>]

          ????? -D/-d <home directory> [-c <gecos>]

          ????? [-t <download bandwidth>] [-T <upload bandwidth>]

          ????? [-n <max number of files>] [-N <max Mbytes>]

          ????? [-q <upload ratio>] [-Q <download ratio>]

          ????? [-r <allow client host>[/<mask>][,<allow client host>[/<mask>]]...]

          ????? [-R <deny client host>[/<mask>][,<deny client host>[/<mask>]]...]

          ???? ?[-i <allow local host>[/<mask>][,<allow client host>[/<mask>]]...]

          ????? [-I <deny local host>[/<mask>][,<deny local host>[/<mask>]]...]

          ????? [-y <max number of concurrent sessions>]

          ????? [-z <hhmm>-<hhmm>] [-m]

          假設我們要創建 joe 這樣一個虛擬用戶,則可以使用如下命令:

          pure-pw useradd joe -u ftpuser -d /home/ftpusers/joe

          其中, -u 將虛擬用戶 joe 同系統用戶 ftpuser 關聯在一起。 -d 參數使 joe 只能訪問其 home 目錄。而如果想讓他訪問整個文件系統,可以用 -D 選項。

          這時,如果 pure-ftpd 啟動時加入 -j(--createhome) 選項,則不需要創建 /home/ftpuser/joe 目錄。系統會在該用戶第一次登陸時自動創建。

          -z 選項運用用戶在一天當中指定的時間段連接服務器。如 -z 0900-1800 ,則該用戶只能在上午 9 點到晚上 6 點之間連接服務器。

          -r 選項或 -R 選項,可以限制用戶從指定 IP 和掩碼連入服務器

          -y ,用戶同一時間的并發連接數。 ’’ 或者 0 意味著不限制

          -f ,默認虛擬用戶的信息會被存放在 /etc/pureftpd.passwd 文件中,通過該選項可以改變該文件的位置。

          用戶的口令會根據系統對加密方式的支持情況,選擇一個最安全的方式進行加密。

          3 .更改一個用戶

          pure-pw adduser 唯一不同的是,使用 pure-pw usermod 不是創建一個用戶,而是更改已經存在用戶的某些屬性。

          重置某些屬性的語法如下:

          pure-pw usermod <user> -n '' :禁用文件配額

          pure-pw usermod <user> -N '' :禁用文件大小配額

          pure-pw usermod <user> -q '' -Q '' :禁用 ratio

          pure-pw usermod <user> -t '' :禁用下載帶寬限制

          pure-pw usermod <user> -T '' :禁用上傳帶寬限制

          pure-pw usermod <user> <-i,-I,-r or -R> '' :禁用 IP 過濾

          pure-pw usermod <user> -z '' :禁用時間段約束

          pure-pw usermod <user> -y '' :禁用并發數限制

          4 .刪除一個用戶

          刪除一個用的命令語法是:

          pure-pw userdel <login> [-f <passwd file>] [-m]

          這時,用戶的信息會被從指定的 passwd 文件中刪除,但是用戶的 home 目錄會被保留,需要手工刪除。

          5 .改變用戶口令

          更改一個用戶口令的語法是:

          pure-pw passwd <login> [-f <passwd file>] [-m]

          6 .顯示用戶信息

          /etc/pureftpd.passwd 文件中記錄的信息不方便用戶的閱讀,因此 pure-ftpd 提供了顯示用戶信息的命令。其語法是:

          pure-pw show <login> [-f <passwd file>]

          7 .提交更改

          可以通過上面提到的命令,或者以手工方式對 /etc/pureftpd.passwd 文件進行修改,從而創建、修改和刪除一個虛擬用戶信息。但是,只有提交這些更改時, pure-ftpd 訪問才能生效。

          提交更改,意味著系統會根據 /etc/pureftpd.passwd (或者指定的其它文件)來創建一個 pure-ftpd 可讀的二進制格式的文件 /etc/pureftpd.pdb 。通常,通過下面的命令:

          pure-pw mkdb

          可以通過 /etc/pureftpd.passwd 文件自動創建 /etc/pureftpd.pbd 文件。但是,如果需要指定特定的文件,可以通過下面的方式來實現:

          pure-pw mkdb /etc/accounts/myaccounts.pdb -f /etc/accounts/myaccounts.txt

          這時,沒有必要去重啟 pure-ftpd 服務,對虛擬用戶進行的更改可以更新。同時,也可以通過 -m 選項,在對 /etc/pureftpd.passwd 文件進行修改的時候自動進行提交。

          8 .打開對虛擬用戶的支持

          使得 pure-ftpd 支持虛擬用戶,需要在編譯的時候加入選項 --with-puredb 。這時,可以通過在啟動服務是的 ’-l’ 參數來設置。如:

          /usr/local/sbin/pure-ftpd -j -lpuredb:/etc/pureftpd.pdb &

          可以在后臺,以自動創建虛擬用戶 home 目錄,用 puredb 的方式來支持虛擬用戶。

          9 .轉換系統用戶

          可以通過如下命令,將系統用戶轉換為虛擬用戶:

          pure-pwconvert

          如果以 root 用戶運行該命令,系統用戶的口令一并被轉入虛擬用戶配置文件。如:

          pure-pwconvert >> /etc/pureftpd.passwd

          10 .環境變量

          默認的情況下,如果指定了環境變量 PURE_PASSWDFILE ,則虛擬用戶的 passwd 文件位置由該變量的值指定。否則,默認是 /etc/pureftpd.passwd 。用樣, PURE_DBFILE 環境變量用來指定 pdb 文件的位置。默認是 /etc/pureftpd.pdb

          posted @ 2006-04-11 00:27 思考 閱讀(3780) | 評論 (0)編輯 收藏

          轉載(http://www.linux-ntfs.org/content/view/127/63/

          This documentation should help you choosing the right RPM for your kernel and Linux distribution, and assist you in installing (and testing) it.

          Which RPM

          It is important to install exactly the same version of NTFS kernel module as the kernel you have installed. Below are some simple instructions to help you find the file you need.

          A quick way to find the version is to use the . Save the file and run it. Then go to the install section.

          				

          ????chmod? 700 ?whichrpm
          ????./whichrpm


          The script, above, just automates what we will do next. First we need to decide which release you have. Run this command:
          				

          ????cat?/etc/redhat-release


          and you will probably see one of the following responses:
          				

          ????Fedora?Core?release?
          3 ?(Heidelberg)
          ????Fedora?Core?release?
          4 ?(Stentz)
          ????Fedora?Core?release?
          5 ?(Bordeaux)
          ????Red?Hat?Linux?release?
          9 ?(Shrike)


          Next find out your kernel version:

          				

          ????uname?-r


          You should see a response something like one of these:

          				

          ????
          2.4.18 - 3 ???
          ????
          2.4.18 - 17.7 .x
          ????
          2.4.22 - 1.2115 .nptl
          ????
          2.6.8 - 1.521


          The version might also have one of the following suffixes:

          				

          ????smp
          ????bigmem
          ????hugemem
          ????BOOT


          Note: If the result ends with smp then you have a multi-processor computer (you probably already knew that).

          Next find out what sort of processor you have. This command will ask which kernel rpm was installed for you.

          Note: If your version number had a suffix, then use it here, e.g. replace kernel with kernel-smp, or kernel-bigmem.

          				

          ????rpm?-q?--queryformat?
          " %{ARCH}\n " ?kernel


          Most people will have an i686 processor (a recent Pentium computer). Other options are athlon, i586 or i386.

          Next download the RPM. Follow the links for

          * Fedora 4 (Stentz)
          * Fedora 3 (Heidelberg)
          * Fedora 2 (Tettnang)
          * Fedora 1 (Yarrow)
          * RedHat Enterprise 4 (Nahant)
          * RedHat Enterprise 3 (Taroon)
          * RedHat 9 (Shrike)
          * RedHat 8.0 (Psyche)
          * RedHat 7.3 (Valhalla)

          When you have downloaded the RPM, we will continue with the installation instructions.

          Install

          You must be root for the rest of the commands. The examples will continue as if you downloaded kernel-ntfs-2.4.18-14.i686.rpm.

          Note: Newer NTFS RPMs have names like


          ????kernel-module-ntfs-
          2.6.8-1.541-2.1.17-0.fc.1.2.i586.rpm


          Next install the rpm:

          ????rpm?-ihv?kernel-ntfs-2.4.18-14.i686.rpm

          ????Preparing...??????###############################?
          [100%]
          ???????
          1:kernel-ntfs??###############################?[100%]


          There should be no errors, just some '#'-charakters.

          Note: newer NTFS RPMs will also print a message telling you if install succeeded.

          If something goes wrong see the
          Help Section.

          This is the only command we actually needed, but we'll go on and test what we have done.

          Next load the kernel module


          ????/sbin/modprobe?ntfs


          There should be no output. If there are a lot of error messages see the Help Section.

          The next command, dmesg prints the kernel logs. We search them for NTFS using grep.


          ????dmesg?|?grep?NTFS

          ????NTFS?driver?v1
          .1.22?[Flags:?R/O?MODULE]


          We can now check that the kernel really understands NTFS. The output may vary slightly, but you are looking for the entry ntfs.


          ????cat?/proc/filesystems

          ????nodev???rootfs
          ????nodev???bdev
          ????nodev???proc
          ????nodev???sockfs
          ????nodev???tmpfs
          ????nodev???shm
          ????nodev???pipefs
          ????????????ext3
          ????????????ext2
          ????nodev???ramfs
          ????nodev???devpts
          ????????????ntfs


          ?

          Mount

          Mounting an NTFS Volume is covered in more detail in Section 4 of the Linux-NTFS FAQ (in the Wiki).

          First you need to know which device your NTFS Volume is on and you need to create a directory as a mount point.

              /sbin/fdisk -l
          


          The output might look like:

              Disk /dev/hda: 64 heads, 63 sectors, 4465 cylinders
              Units = cylinders of 4032 * 512 bytes
          
                 Device Boot    Start       End    Blocks   Id  System
                 /dev/hda1             1      2125   4283968+  07  NTFS/HPFS
                 /dev/hda2          2126     19851  35735616   0f  Win95 Ext'd (LBA)
                 /dev/hda5   *      2126      4209   4201312+  83  Linux
                 /dev/hda6          4210      4465    516064+  82  Linux swap
                    
          
              mkdir /mnt/windows
              mount /dev/hda1 /mnt/windows -t ntfs -r -o umask=0222
              ls -l /mnt/windows
          
              ...
              -r-xr--r-- 1 root root  9719 Aug 24 1996 ansi.sys
              -r-xr--r-- 1 root root 15252 Aug 24 1996 attrib.exe
              -r-xr--r-- 1 root root 28096 Aug 24 1996 chkdsk.exe
              -r-xr--r-- 1 root root  5175 Aug 24 1996 choice.com
              ...
          


          Hopefully everything is working for you now.

          Note: Now, please read the NTFS FAQ (Frequently Asked Questions, in the Wiki), especially if you want to know:

          * How to change the owner or permissions of the mounted partition (Section 4.9) * How to have Linux mount the partition automatically at boot time (Section 4.10)

          Uninstall

          If you wish to remove the NTFS RPM, first list all the RPMs with ntfs in their name. You output might look something like this:

              rpm -qa | grep -i ntfs
          
              kernel-module-ntfs-2.6.9-1.667smp-2.1.20-0.fc.1.2
          


          Then, cut and paste the name into the rpm erase command:

              rpm -e kernel-module-ntfs-2.6.9-1.667smp-2.1.20-0.fc.1.2
          
          posted @ 2006-04-06 14:49 思考 閱讀(492) | 評論 (0)編輯 收藏

          ??????為了充分教研室服務器的資源,打算在服務器上安裝一個流媒體點播系統。為此,選擇使用Real公司的Helix產品。只要有合適的License,Helix可以支持絕大多數的流媒體格式,包括:
          RealNetworks:??????????RealAudio (.rm, .ra), RealVideo (.rm, .rmvb), RealPix (.rp),RealText (.rt), Multi-Rate Container (.mrc)
          Macromedia:?????????????Flash (.swf)
          Microsoft:???????????????? Windows Media (.asf, .wma, .wmv)
          Apple:??????????????????????QuickTime (.mov)
          Standards-Based:??????MPEG-4, MP3
          Image Formats:?????????GIF (.gif), JPEG (.jpg, jpeg), PNG (.png)
          Other:??????????????????????AU (.au), AIFF (.aif, .ief), WAV (.wav)

          ??????教研室的服務器安裝的是Fedora Core 4 x86_64系統,開始只找到了Helix Server 9.0.2.794。安裝之后,運行時提示錯誤:

          * Heartbeat Failure 1 (Step 3)

          -------------------------------------------------------------------------------
          *** Helix Server Heartbeat Failure Report
          When: 04-Apr-06 14:09:41
          Environment: linux-2.2-libc6-i586-server, , 9.0.2.794
          * Heartbeat Failure 2 (Step 3)

          -------------------------------------------------------------------------------
          *** Helix Server Heartbeat Failure Report
          When: 04-Apr-06 14:10:04
          Environment: linux-2.2-libc6-i586-server, , 9.0.2.794
          * Heartbeat Failure 3 (Step 3)


          Helix Server not responding normally...
          Heartbeat check disabled
          * Heartbeat Failure 4 (Step 3)
          * Heartbeat Failure 5 (Step 3)
          * Heartbeat Failure 6 (Step 3)
          * Heartbeat Failure 7 (Step 3)

          在網上找了很多相關的資料,都沒解決這個問題。后來考慮可能時系統版本的問題,于是下載了Helix Server 11.0.1.1884。在這個版本自帶的文檔中介紹了遇到上述問題時,可以在配置文件結尾加入如下3行代碼:
          <List Name="IPBindings">。
          ??????<Var Address_01="any"/>
          </List>
          其中,any指得是服務器的IP地址。但是,按照這種方式修改,在我們的服務器上依然存在上面的問題,不知道其它版本的Linux系統是否可以解決。遇到相同問題的人可以嘗試一下這種辦法。

          ?????????在11這個版本中,啟動時已經不會出現這個問題了。但是當服務啟動了之后,我在本地計算機上無法訪問。但是在服務器上通過localhost可以正常使用。這個問題可能是防火墻的問題,于是加入了相應的規則,但是依然無法訪問。后來,經過翻閱資料,得知如果是服務器上有多個網卡,需要對其進行綁定。否則,只能通過localhost來訪問。原來是這樣,在服務器上通過瀏覽器,在管理員界面加入了相應的規則。重啟服務,哈哈,終于可以訪問了!

          ?????????最后,可以在sample頁面對支持的流媒體格式進行測試。在測試的時候,還有一些小的插曲。因為我們現在多數人用的是暴風影音,像我就根本沒有安裝realplayer。所以,開始是出現rmvb格式的媒體無法觀看的問題。后來重新安裝了realoneplayer之后解決了上述問題。另外一個讓我弄了一個多小時的問題是,無法播放MP3格式的文件。最后,把用來播放MP3的插件——mp3fformat.so的文件從Plugins目錄移出,重啟系統,再移入,重啟系統。后來就可以播放了。具體原因還不知道為什么:?不管怎么樣,最后是大功告成了,可以正常使用了。

          ?????????接下來的任務就是設置加載點,使用ftp目錄中的媒體來供教研室的同學訪問了。

          PS:Helix似乎不支持中文,所以接下來可能要作一件事情,就是如何將中文文件名可以被使用。

          posted @ 2006-04-04 14:39 思考 閱讀(2417) | 評論 (3)編輯 收藏

          dmesg???查看啟動信息
          chkconfig???配置啟動信息
          setup?????????圖形化的安裝配置信息

          makewhatis????為man手冊頁建立索引
          whatis????????????以完整字符匹配的方式查詢man手冊頁
          apropos?????????查詢man手冊頁

          updatedb??????建立和更新slocate的數據庫
          slocate?????????以更安全的方式向用戶提供在整個文件系統中搜索有權限的文件
          locate????????????slocate的符號連接,在GNU Linux下
          whereis?????????定位源文件、二進制文件和手冊頁

          rpm -ivh??????安裝RPM包
          rpm -e?????????刪除RPM包
          rpm -qpl??????RPM包中的文件內容
          rpm -qa??????查詢系統中已經安裝的RPM包信息

          ntpdate -u????根據指定網絡時間服務器的時間更新系統時間

          mount -t vfat -o CHARSET=cp936
          ?????????????????????可以顯示Windown FAT32系統中的中文

          posted @ 2006-03-31 11:19 思考 閱讀(331) | 評論 (0)編輯 收藏
               摘要: F1 打開幫助。 ...  閱讀全文
          posted @ 2006-03-28 23:12 思考 閱讀(268) | 評論 (0)編輯 收藏
          前一段時間因為搞鑒定,所以就把手頭的工作停了下來,現在搞完了,可以繼續寫些東西了。
          posted @ 2006-03-28 14:29 思考 閱讀(181) | 評論 (0)編輯 收藏
          昨天同組的在安裝GT4后,啟動容器時發生上面的錯誤。
          因為我使用相同的方法在另外一臺服務器上已經成功安裝,并且沒有問題。所以這個問題讓我們很多人都不知道如何是好。后來用-debug參數啟動進行分析,只有可能是數據庫的問題。因為兩臺服務器上mysql的數據庫的版本不同。所以我們懷疑是mysql的connector的版本不同造成的。
          今天早晨下了一個3.2.0版本的connector,將原先的3.1.10版本的connector替換掉問題就解決了。
          但是,后來發現問題不是這個版本造成的。因為3.1.10版本的connector包含了兩個文件:
          ???????????????mysql-connector-java-3.1.10-bin-g.jar
          ???????????????mysql-connector-java-3.1.10-bin.jar
          只要把mysql-connector-java-3.1.10-bin-g.jar的文件刪掉也可以成功啟動。
          后來看了一些connector的說明文檔,發現帶-g的是用來做debug用的。
          posted @ 2005-10-29 16:35 思考 閱讀(6068) | 評論 (3)編輯 收藏
          剛才在安裝mysql之后,用netstat -a |grep 3306來查看mysqld是否已經運行的時候,發現無法查看。
          后來高手指點說,應該將命令改為netstat -an |grep 3306。果然,這樣一改,可以看到了。原來-n參數是指用數字來代替使用可能的host、port或user name。所以要使用這個參數。相反,如果命令改成這樣,也應該可以正確執行:
          netstat -a |grep mysql
          posted @ 2005-10-27 18:21 思考 閱讀(222) | 評論 (0)編輯 收藏

          困擾我多久的在SecurityCRT中登錄Linux是,有些英文顯示出現亂碼。
          今天無意間發現了SecurityCRT幫助文件中Strip 8 bit的修改。才想到可能是這個問題。
          隨后,選擇在Options->Session Options->Terminal->Advanced下面的Strip 8 bit選項。應用后在此鍵入可能造成亂碼的命令,如man route。發現原先顯示亂碼的部分變成了英文了:)
          分析原因,是因為在純英文終端上(最原始的終端類型),每個英文字母是用7位表示的。而后來為了增加對其它語言的支持,又加入了第8位。這就是當初使用BBS是,telnet后面要加入-8的參數的原因。但是正是因為這樣,我們的Linux服務器沒有配置中文的支持,所以以7位方式來傳輸英文。而這時SecurityCRT安裝8位進行解釋,可能就造成亂碼的錯誤。

          posted @ 2005-10-27 18:05 思考 閱讀(1542) | 評論 (1)編輯 收藏

          which - shows the full path of (shell) commands.
          whereis - locate the binary, source, and manual page files for a command.
          slocate - Security Enhanced version of the GNU Locate. 
                    Secure  Locate  provides  a  secure  way to index and quickly search for files on your system. It uses
                 incremental encoding just like GNU locate to compress its database to make searching faster, but it  will
                 also store file permissions and ownership so that users will not see files they do not have access to.

                    This  manual page documents the GNU version of slocate.  slocate Enables system users to search entire
                 filesystems without displaying unauthorized files.

          tee - read from standard input and write to standard output and files
          vipw, vigr - edit the password or group files
          cat - concatenate files and print on the standard output
          cat /etc/passwd

          id - print real and effective UIDs and GIDs
          who - show who is logged on
          users - print the user names of users currently logged in to the current host
          finger - user information lookup program

          !! - execute the last command

          posted @ 2005-10-26 16:25 思考 閱讀(279) | 評論 (1)編輯 收藏
          僅列出標題
          共5頁: 上一頁 1 2 3 4 5 下一頁 
          主站蜘蛛池模板: 简阳市| 昆明市| 襄汾县| 安溪县| 齐齐哈尔市| 龙陵县| 海城市| 上饶县| 高阳县| 嘉定区| 溧水县| 金华市| 潢川县| 钦州市| 清远市| 陆川县| 海阳市| 九江县| 三门县| 通辽市| 陆良县| 绥宁县| 苏尼特左旗| 济阳县| 策勒县| 南漳县| 获嘉县| 历史| 天全县| 海盐县| 罗定市| 太原市| 唐河县| 兴仁县| 尉氏县| 新丰县| 自治县| 定州市| 衢州市| 平原县| 浮梁县|