블로그 이미지
22Hz 22Hz

카테고리

분류 전체보기 (109)
모의해킹 침해대응 전문가 과정 (99)
리눅스 설정 (10)
Total
Today
Yesterday

달력

« » 2025.5
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

공지사항

태그목록

최근에 올라온 글

================================================메모================================================

\\172.16.13.1
\04_과정진행
\01_1.1_정보보안 및 정보보안전문가의 역할
파일이름 : 정보보안및정보보안전문가의역할.hwp

================================================강의================================================

6 WEB Mail (Open Source Web Mail)

무료 웹메일의 종류

■ Roundcube Webmail
   - http://roundcube.net/

■ Squirrelmail (일명: 다람쥐 웹메일)
   - http://squirrelmail.org/
   - http://blog.naver.com/dwb01?Redirect=Log&logNo=40063038950
   - http://blog.naver.com/june8th98/150014363290
   - http://moyaria.tistory.com/59
   - http://kjhfull.tistory.com/entry/centoswebmail

■ Nutsmail
   - http://nutsmail.com/

■ Atmail
   - http://atmail.com/

[EX1] 다람쥐 웹메일 설치하고 설정하기

설정할 때 다음과 같이 사이트를 참고 하였다.
   - http://blog.naver.com/dwb01?Redirect=Log&logNo=40063038950
   - http://kjhfull.tistory.com/entry/centoswebmail
   - http://blog.naver.com/june8th98/150014363290
   - http://moyaria.tistory.com/59

http://www.spamassassin.org/
The official site of the SpamAssassin project.
(설정하는 방법 참고) http://blog.naver.com/PostView.nhn?blogId=khi830&logNo=20107472547

NFS(Network File System)
■ 분산 파일 시스템 : NFS(UNIX/LINUX), CIFS(WINDOWS)

(1) NFS 서버 데몬
NFS 서버는 언제든지 클라이언트가 마운트 할 수 있도록 준비 되어 있어야 하며 NFS는 rpc.mountd, rpc.nfsd 두 데 몬을 가지고 있다. rpc.mountd 데몬과 rpc.nfsd 데몬은 RPC 기반의 서비스이기 때문에, rpcbind(portmapper)가 반 드시 떠 있어야만 사용이 가능하다.

(2) NFS 관련 파일 
■ /etc/exports (NFS Server)에서 부팅시에 공유하는 정보를 담는 파일
■ /etc/fstab  (NFS Client)에서 부팅시에 마운트하는 정보를 담는 파일

(3) NFS 관련 명령어
■ exportfs 명령어 (NFS Server) 공유자원을 확인 할 때 사용하는 명령어
■ showmount 명령어 (NFS Client) 공유할 자원 확인 할 때 사용하는 명령어
■ mount 명령어 (NFS Client) 공유된 자원 마운트 할 때 사용하는 명령어

(3-1) exportfs 명령어

NFS 서버에서 공유된 자원을 확인 할 때 사용하는 명령어이다.

(명령어 형식)
# exportfs         /* 공유된 자원 정보를 간략하게 보여준다. */
# exportfs -v      /* 공유된 자원 정보를 자세하게 보여준다. */
# exportfs -ar     /* 공유된 자원 목록(예: /etc/exports)을 다시 읽는다.(reread) */

■ NFS 서버에서 디렉토리 공유 방법
------------------------------------------
(첫번째 방법)  # vi /etc/exports
/share  *(rw)
# service nfs restart
------------------------------------------
(두번째 방법) # vi /etc/exports
/share  *(rw)
# exportfs -ar
------------------------------------------

(3-2) showmount 명령어

NFS 서버의 공유된 자원을 확인할 때 사용한다.

(명령어 형식)
# showmount -e                /* 로컬 서버에 공유된 자원 확인 */
# showmount -e 172.16.9.252   /* 원격 서버에 공유된 자원 확인 */

(3-3) mount 명령어

NFS 서버의 공유된 자원을 마운트 할 때 사용하는 명령어이다.
현재 마운트 할 때는 mount 명령어를 사용하고 부팅시에 마운트하기 위해서는 /etc/fstab 파일을 사용한다.

(명령어 형식)
# mount [-t nfs] nfs.linux.co.kr:/usr/local /usr/local
# mount [-t nfs] 172.16.9.2XX:/share /mnt/share

(4) NFS 서비스 제어

(현재서비스 제어)
# service nfs start     /* NFS 서비스 start */
# service nfs stop      /* NFS 서비스 stop */
# service nfs restart   /* NFS 서비스 restart */
# service nfs status    /* NFS 서비스 상태 확인 */
# service nfs reload    /* NFS 설정 파일 다시 읽기(# exportfs –ar) */

(부팅시 서비스 제어)
# chkconfig nfs on        (# chkconfig --level 35 nfs on)
# ntsysv                  (# setup)
# system-config-service   (# serviceconf)

(NFS GUI 방식의 설정 툴)
# system-config-nfs &
# cat /etc/exports
# exportfs

3 NFS(Network File System) 서버 실습
■ root 사용자의 서버 자원 마운트
■ Man Page 서버 구축
■ Home Directory 서버 구축
■ 원격 CD 마운트
■ 원격 백업 서버 구축


■ (NFS Server/Client에서 UID/GID 퍼미션 관계)

==== NFS Server =====                       ==== NFS Client =====
 # vi /etc/exports                           # mount S:/share /p
 /share/file1        <-- UID/GID check -->     /p/file1
 /share/dir1                                   /p/dir1
=====================                       ======================
/share/file1(rw-r--r-- user01 other)           /p/file1(rw-r--r--  500  1 )
user01(UID=500)                                     A
                                                    | 
                                                    |
                                                  user01 (# cd /p ; cat file1)
                                                  (UID=500)

/share/file1(rw-r--r-- root root)              /p/file1(rw-r--r--   0   0 )
root(UID=0)                                         A
                                                    | 
                                                    |
                                                   root (# cd /p ; cat file1)
                                                 (UID=0)
                                                    A
                                                    |
                                                    +---> (root(X) -> anonymous(nfsnobody))

[참고] no_root_squash 옵션(root_squash <----> no_root_squash)
NFS 서버에서 NFS 클라이언트의 root 사용자를 인정할 때 사용하는 공유 옵션이다.


(실무 예) Diskless Client(EX: Hardless Client)

Diskless Server (/disk/OS1) ------> Diskless Client(/)
http://aroundck.tistory.com/849

(실무 예) Application Server

■ 노트북(window/vmware/linux(centos))
# rpm --root=/disk/app1 -ivh <PKG>.rpm
# vi /etc/exports
/disk *(rw)
# service nfs restart

■ 상용서버
# mkdir -p /mnt/app1
# mount IP:/disk /mnt/app1


(실무 예) 오락서버(EX: 리니지), 메일서버(EX: daum.net/naver.com)

오락서버(EX: 리니지)
10000 대(NFS 클라이언트)
- server1(/home/user01)              NFS 서버(NAS)
- server2(/home/user01)              (/export/home/user01)
- server3(/home/user01)
- server4(/home/user01)
- .....

(실무 예) 웹서버(EX: 이중화)

WEB1(/www)
WEB2(/www)                           NFS 서버(NAS) - /www
WEB3(/www)


[EX4] 원격서버의 CD 마운트 

리눅스 서버에는 CD-ROM이 장착이 되지 않은 서버가 존재할 수 있다. 이런 경우, 다른 서버에 존재하는 CD-ROM에 CD를 장착하고 공유한후, 마운트 해서 사용하면 된다.

리눅스 서버에 CD-ROM이 고장난 경우
리눅스 서버중에 CD-ROM이 없는 서버의 경우


1. 네트워크 파일 서비스의 종류(Network File Service Type)

네트워크를 지원하는 수 많은 플랫폼들은 각각 자신의 플랫폼에 사용할 목적으로 다양한 파일 서비스 규격들을 만들어 냈다. 개별적인 플랫폼을 위해 만들어진 이러한 기술들은 자신의 플랫폼 내에서만 호환성을 가지고 있던 초기의 제한점을 넘어서 지금은 다양한 이기종의 플랫폼과 호환될 수 있는 형태로 확장되어 가고 있다.

네트워크 파일 서비스의 종류는 다음과 같다.
l NFS(Network File System)
l AFS(Andrew File System)
l NetWare
l Lan Manager
l Microsoft Network Service(CIFS)
l Apple Talk

Linux(NFS)     | Windows(CIFS)
---------------+--------+-------
SAMBA(CIFS) <--+--------+
     |         |
     V         |
  /share       |


2. 삼바(SAMBA) 서버 개요

■ (서버)Linux  <-----  NFS     -----> (클라이언트/서버)Linux/UNIX
■ (서버)Linux  <----- CIFS/SMB -----> (클라이언트/서버)Windows

마이크로소프트에서는 SMB라는 이름보다는 좀 더 범위가 큰  CIFS(Common  Internet  File  System)라는 프로토콜로 부른다. 이 프로토콜은  SMB 프로토콜에  Lan Manager, NetBIOS 프로토콜까지 포함한다.

삼바(SAMBA) 공식 사이트: http://www.samba.org

(1) 삼바(SAMBA)의 기능

SAMBA 기능은 유닉스/리눅스 플랫폼 환경에서 파일과 하드웨어(CD-ROM, Printer)를 서로 공유할 수 있게 해주는 프 로토콜이다. 이것을 정리해 보면 다음과 같다.

- 유닉스/리눅스 파티션과 윈도우와의 공유
- 윈도우 파티션과 유닉스/리눅스와의 공유
- 유닉스/리눅스의 프린터와 윈도우와의 공유
- 윈도우의 프린터와 유닉스와의 공유

(2) 삼바(SAMBA)의 활용

- 유닉스/리눅스 서버의 디렉토리를 MS 윈도우에서의 하나의 드라이브로 사용
- 프린터 공유
- 유닉스/리눅스 서버의 FTP 대치(EX: File Server)    
- CD-ROM 데이터 공유
- 백업(Backup) 시스템으로 사용

3. 삼바(SAMBA) 서버

패키지: samba, samba-clinet, samba-common
----- Linux(SAMBA) Server -----      ----- Windows 7 Server -----
      (linux2XX)
nmbd(137,138)
smbd(139)
- /etc/samba/smb.conf
-------------------------------      ----------------------------

ㅇ nmbd(NetBIOS Name Server)
   - 자원 검색(Resource Browing)
   - WINS 서버 관리(WINS Server)
ㅇ smbd(SMB/CIFS Server)
   - 인증/인가 관리(Authentication and Authorization)
   - 파일/프린터 공유 관리(File and Printer Sharing)

   * SMB(오픈버전) = CIFS(라이센스버전)

4. 삼바(SAMBA) 관련 명령어
■ smbclient 명령어
■ smbstatus 명령어
■ testparm 명령어
■ mount.cifs/umount.cifs 명령어

================================================실습================================================

① 다람쥐 웹메일 설치(squirrelmail 프로그램 설치)
# yum list | grep squirrelmail

# yum -y install squirrelmail
-> 출력 과정 생략

# rpm -ql squirrelmail

② 소유권 변경
# chown apache.apache -R /usr/share/squirrelmail
# chown apache.apache /etc/squirrelmail/config.php
# chown apache.apache -R /var/lib/squirrelmail
# chown apache.apache -R /var/spool/squirrelmail

③ 다람쥐 웹 메일 설정

(선수작업)
터미널에서 오른쪽 마우스 선택 > Edit Current Profile > Colors >
Text Color       : 빨강
Background color : 회색

# /usr/share/squirrelmail/config/conf.pl

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color off
S   Save data
Q   Quit

Command >> 2











SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1.  Domain                 : localhost
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail

A.  Update IMAP Settings   : localhost:143 (uw)
B.  Change Sendmail Config : /usr/sbin/sendmail

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> 1

The domain name is the suffix at the end of all email addresses.  If
for example, your email address is jdoe@example.com, then your domain
would be example.com.

[localhost]: linux220.example.com









SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1.  Domain                 : linux220.example.com
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail

A.  Update IMAP Settings   : localhost:143 (uw)
B.  Change Sendmail Config : /usr/sbin/sendmail

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> A












SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1.  Domain                 : linux220.example.com
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail

IMAP Settings
--------------
4.  IMAP Server            : localhost
5.  IMAP Port              : 143
6.  Authentication type    : login
7.  Secure IMAP (TLS)      : false
8.  Server software        : uw
9.  Delimiter              : /

B.  Change Sendmail Config : /usr/sbin/sendmail
H.  Hide IMAP Server Settings

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> 4

This is the hostname where your IMAP server can be contacted.
[localhost]: mail.linux220.example.com






SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1.  Domain                 : linux220.example.com
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail

IMAP Settings
--------------
4.  IMAP Server            : mail.linux220.example.com
5.  IMAP Port              : 143
6.  Authentication type    : login
7.  Secure IMAP (TLS)      : false
8.  Server software        : uw
9.  Delimiter              : /

B.  Change Sendmail Config : /usr/sbin/sendmail
H.  Hide IMAP Server Settings

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> 8

Each IMAP server has its own quirks.  As much as we tried to stick
to standards, it doesn't help much if the IMAP server doesn't follow
the same principles.  We have made some work-arounds for some of
these servers.  If you would like to use them, please select your
IMAP server.  If you do not wish to use these work-arounds, you can
set this to "other", and none will be used.
    cyrus       = Cyrus IMAP server
    uw          = University of Washington's IMAP server
    exchange    = Microsoft Exchange IMAP server
    courier     = Courier IMAP server
    macosx      = Mac OS X Mailserver
    hmailserver = hMailServer
    other       = Not one of the above servers
[uw]: other

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1.  Domain                 : linux220.example.com
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail

IMAP Settings
--------------
4.  IMAP Server            : mail.linux220.example.com
5.  IMAP Port              : 143
6.  Authentication type    : login
7.  Secure IMAP (TLS)      : false
8.  Server software        : other
9.  Delimiter              : /

B.  Change Sendmail Config : /usr/sbin/sendmail
H.  Hide IMAP Server Settings

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> S

Data saved in config.php
Press enter to continue...






SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1.  Domain                 : linux220.example.com
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail

IMAP Settings
--------------
4.  IMAP Server            : mail.linux220.example.com
5.  IMAP Port              : 143
6.  Authentication type    : login
7.  Secure IMAP (TLS)      : false
8.  Server software        : other
9.  Delimiter              : /

B.  Change Sendmail Config : /usr/sbin/sendmail
H.  Hide IMAP Server Settings

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> R







SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color off
S   Save data
Q   Quit

Command >> 10











SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Language preferences
1.  Default Language       : en_US
2.  Default Charset        : iso-8859-1
3.  Enable lossy encoding  : false

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> 1

SquirrelMail attempts to set the language in many ways.  If it
can not figure it out in another way, it will default to this
language.  Please use the code for the desired language.

[en_US]: ko_KR












SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Language preferences
1.  Default Language       : ko_KR
2.  Default Charset        : iso-8859-1
3.  Enable lossy encoding  : false

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> 2

This option controls what character set is used when sending
mail and when sending HTML to the browser.

This option is used only when default language is 'en_US'.

[iso-8859-1]: euc-kr   











SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Language preferences
1.  Default Language       : ko_KR
2.  Default Charset        : euc-kr
3.  Enable lossy encoding  : false

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> S

Data saved in config.php
Press enter to continue...













SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Language preferences
1.  Default Language       : ko_KR
2.  Default Charset        : euc-kr
3.  Enable lossy encoding  : false

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> Q


Exiting conf.pl.
You might want to test your configuration by browsing to
http://your-squirrelmail-location/src/configtest.php
Happy SquirrelMailing!

[root@linux220 ~]#


[root@linux220 ~]# vi /etc/httpd/conf/httpd.conf
[root@linux220 ~]# cat /etc/httpd/conf/httpd.conf | grep /webmail/
Alias /webmail/ "/usr/share/squirrelmail/"
[root@linux220 ~]# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd: [Tue May 10 16:43:12 2016] [warn] The Alias directive in /etc/httpd/conf/httpd.conf at line 540 will probably never match because it overlaps an earlier Alias.
                                                           [  OK  ]
[root@linux220 ~]# vi /var/named/chroot/var/named/example220.zone
[root@linux220 ~]# cat /var/named/chroot/var/named/example220.zone | grep www
www                                                             IN      A               172.16.6.220
www1                            IN  A       172.16.6.120
www2                            IN  A       172.16.6.120
www3                            IN  A       172.16.6.120
;www                                                            IN      A               172.16.6.2
;www                                                            IN      A               172.16.6.3
;www                                                            IN      A               172.16.6.4
[root@linux220 ~]# service named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]
[root@linux220 ~]# nslookup www.linux220.example.com
Server:         172.16.6.220
Address:        172.16.6.220#53

Name:   www.linux220.example.com
Address: 172.16.6.220

[root@linux220 ~]# firefox http://www.linux220.example.com/webmail/src/login.php


그림1
그림2



[root@linux220 ~]# mkdir -p /share
[root@linux220 ~]# vi /etc/exports
[root@linux220 ~]# cat /etc/exports
#
# (1) Sharing For Client
#
/share                                  172.16.0.0/255.255.0.0(rw)
[root@linux220 ~]# service nfs restart
Shutting down NFS mountd:                                  [FAILED]
Shutting down NFS daemon:                                  [FAILED]
Shutting down NFS quotas:                                  [FAILED]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@linux220 ~]# chkconfig nfs on
[root@linux220 ~]# exportfs
/share          172.16.0.0/255.255.0.0
[root@linux220 ~]# exportfs -v
/share          172.16.0.0/255.255.0.0(rw,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
[root@linux220 ~]# mkdir -p /share1
[root@linux220 ~]# vi /etc/exports
[root@linux220 ~]# cat /etc/exports
#
# (1) Sharing For Client
#
/share                                  172.16.0.0/255.255.0.0(rw)
/share1                                 172.16.0.0/255.255.0.0(rw)
[root@linux220 ~]# exportfs -ar
[root@linux220 ~]# -a : all, -r : reread(/etc/exports)
[root@linux220 ~]# exportfs -v
/share1         172.16.0.0/255.255.0.0(rw,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/share          172.16.0.0/255.255.0.0(rw,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
[root@linux220 ~]#


[root@linux220 ~]# showmount -e
Export list for linux220.example.com:
/share  172.16.0.0/255.255.0.0
/share1 172.16.0.0/255.255.0.0
[root@linux220 ~]# showmount -e 172.16.6.220
Export list for 172.16.6.220:
/share  172.16.0.0/255.255.0.0
/share1 172.16.0.0/255.255.0.0
[root@linux220 ~]# showmount -e 172.16.6.249
Export list for 172.16.6.249:
/share  172.16.0.0/255.255.0.0
/share1 172.16.0.0/255.255.0.0
[root@linux220 ~]#


[NFS_Server]

[root@linux220 ~]# mkdir /share2 /share3
[root@linux220 ~]# vi /etc/exports
[root@linux220 ~]# cat /etc/exports
#
# (1) Sharing For Client
#
/share                                  172.16.0.0/255.255.0.0(rw)
/share1                                 172.16.0.0/255.255.0.0(rw)
/share2                                 172.16.0.0/255.255.0.0(rw)
/share3                                 172.15.0.0/255.255.0.0(rw)
[root@linux220 ~]# service nfs restart
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@linux220 ~]# exportfs
/share1         172.16.0.0/255.255.0.0
/share2         172.16.0.0/255.255.0.0
/share3         172.15.0.0/255.255.0.0
/share          172.16.0.0/255.255.0.0
[root@linux220 ~]#


[NFS_Client]

[root@linux120 ~]# showmount -e 172.16.6.220
Export list for 172.16.6.220:
/share  172.16.0.0/255.255.0.0
/share3 172.15.0.0/255.255.0.0
/share2 172.16.0.0/255.255.0.0
/share1 172.16.0.0/255.255.0.0
[root@linux120 ~]# mkdir -p /p /p1 /p2 /p3
[root@linux120 ~]# mount 172.16.6.220:/share /p
[root@linux120 ~]# df -h
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext3     36G  5.0G   29G  15% /
/dev/sda8     ext3    487M   11M  451M   3% /data1
/dev/sda7     ext3    487M   11M  451M   3% /data2
/dev/sda6     ext3    487M   11M  451M   3% /data3
/dev/sda5     ext3    487M   11M  451M   3% /data4
/dev/sda3     ext3    487M   11M  451M   3% /home
tmpfs        tmpfs    506M     0  506M   0% /dev/shm
/dev/hdc   iso9660    3.9G  3.9G     0 100% /media/CentOS_5.5_Final
172.16.6.220:/share
               nfs     36G  5.0G   29G  15% /p
[root@linux120 ~]# mount 172.16.6.220:/share3 /p3
mount: 172.16.6.220:/share3 failed, reason given by server: Permission denied
[root@linux120 ~]#


[NFS_Server]

[root@linux220 ~]# cd /share
[root@linux220 /share]# mkdir dir1
[root@linux220 /share]# cp /etc/passwd file1
[root@linux220 /share]# cp /etc/group dir1/file2
[root@linux220 /share]# ls -R
.:
dir1  file1

./dir1:
file2
[root@linux220 /share]# find .
.
./dir1
./dir1/file2
./file1
[root@linux220 /share]#


[NFS_Client]

oot@linux120 ~]# cd /p
[root@linux120 /p]# ls
dir1  file1
[root@linux120 /p]# mkdir -p /test
[root@linux120 /p]# cp file1 /test
cp: overwrite `/test/file1'? y
[root@linux120 /p]# cat /test/file1 | more
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
distcache:x:94:94:Distcache:/:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin
dovecot:x:97:97:dovecot:/usr/libexec/dovecot:/sbin/nologin
squid:x:23:23::/var/spool/squid:/sbin/nologin
pcap:x:77:77::/var/arpwatch:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
avahi:x:70:70:Avahi daemon:/:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
named:x:25:25:Named:/var/named:/sbin/nologin
hsqldb:x:96:96::/var/lib/hsqldb:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
avahi-autoipd:x:100:102:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin
xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin
gdm:x:42:42::/var/gdm:/sbin/nologin
sabayon:x:86:86:Sabayon user:/home/sabayon:/sbin/nologin
[root@linux120 /p]# cd
[root@linux120 ~]# umount /p
[root@linux120 ~]# df -h
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext3     36G  5.0G   29G  15% /
/dev/sda8     ext3    487M   11M  451M   3% /data1
/dev/sda7     ext3    487M   11M  451M   3% /data2
/dev/sda6     ext3    487M   11M  451M   3% /data3
/dev/sda5     ext3    487M   11M  451M   3% /data4
/dev/sda3     ext3    487M   11M  451M   3% /home
tmpfs        tmpfs    506M     0  506M   0% /dev/shm
/dev/hdc   iso9660    3.9G  3.9G     0 100% /media/CentOS_5.5_Final


[NFS_Server]

[root@linux220 /share]# service nfs status
rpc.mountd (pid 15518) is running...
nfsd (pid 15515 15514 15513 15512 15511 15510 15509 15508) is running...
rpc.rquotad (pid 15502) is running...
[root@linux220 /share]# mkdir /share4
[root@linux220 /share]# vi /etc/exports
[root@linux220 /share]# cat /etc/exports
#
# (1) Sharing For Client
#
/share                                  172.16.0.0/255.255.0.0(rw)
/share1                                 172.16.0.0/255.255.0.0(rw)
/share2                                 172.16.0.0/255.255.0.0(rw)
/share3                                 172.15.0.0/255.255.0.0(rw)
/share4                                 *(rw)
[root@linux220 /share]# service nfs restart
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@linux220 /share]# service nfs reload
[root@linux220 /share]# exportfs
/share1         172.16.0.0/255.255.0.0
/share2         172.16.0.0/255.255.0.0
/share3         172.15.0.0/255.255.0.0
/share          172.16.0.0/255.255.0.0
/share4         <world>
[root@linux220 /share]#


[root@linux220 /share]# system-config-
system-config-authentication     system-config-network            system-config-samba
system-config-date               system-config-network-cmd        system-config-securitylevel
system-config-display            system-config-network-gui        system-config-securitylevel-tui
system-config-httpd              system-config-network-tui        system-config-services
system-config-kdump              system-config-nfs                system-config-soundcard
system-config-keyboard           system-config-packages           system-config-time
system-config-language           system-config-printer            system-config-users
system-config-lvm                system-config-rootpassword      
[root@linux220 /share]# system-config-
[root@linux220 /share]# mkdir /share5
[root@linux220 /share]# system-config-nfs
[root@linux220 /share]# pic03,04
[root@linux220 /share]# cat /etc/exports
#
# (1) Sharing For Client
#
/share                                  172.16.0.0/255.255.0.0(rw)
/share1                                 172.16.0.0/255.255.0.0(rw)
/share2                                 172.16.0.0/255.255.0.0(rw)
/share3                                 172.15.0.0/255.255.0.0(rw)
/share4                                 *(rw)
/share5                        *(ro,sync)
[root@linux220 /share]# exportfs
/share1         172.16.0.0/255.255.0.0
/share2         172.16.0.0/255.255.0.0
/share3         172.15.0.0/255.255.0.0
/share          172.16.0.0/255.255.0.0
/share4         <world>
/share5         <world>




[NFS_Server]

[root@linux220 ~]# cp /etc/exports /etc/exports.old
[root@linux220 ~]# > /etc/exports
[root@linux220 ~]# cat /etc/exports
[root@linux220 ~]# mkdir -p /share
[root@linux220 ~]# vi /etc/exports
[root@linux220 ~]# cat /etc/exports
#
# (1) NFS Server Test
#
/share                  172.16.0.0/255.255.0.0(rw)
[root@linux220 ~]# service nfs restart
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@linux220 ~]# erportfs
bash: erportfs: command not found
[root@linux220 ~]# exportfs
/share          172.16.0.0/255.255.0.0
[root@linux220 ~]# rm -rf /share/*
[root@linux220 ~]# touch /share/testfile.txt
[root@linux220 ~]# ls -ld /share
drwxr-xr-x 2 root root 4.0K May 10 18:20 /share
[root@linux220 ~]# ls -l /share/testfile.txt
-rw-r--r-- 1 root root 0 May 10 18:20 /share/testfile.txt
[root@linux220 ~]#

----- linux2XX -----
/share (rwxr-xr-x root root)
   |
   +----- testfile.txt (rw-r--r-- root root)


[NFS_Client]

[root@linux120 ~]# showmount -e 172.16.6.220
Export list for 172.16.6.220:
/share 172.16.0.0/255.255.0.0
[root@linux120 ~]# mkdir -p /mnt/server
[root@linux120 ~]# mount 172.16.6.220:/share /mnt/server
[root@linux120 ~]# df -h
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext3     36G  5.0G   29G  15% /
/dev/sda8     ext3    487M   11M  451M   3% /data1
/dev/sda7     ext3    487M   11M  451M   3% /data2
/dev/sda6     ext3    487M   11M  451M   3% /data3
/dev/sda5     ext3    487M   11M  451M   3% /data4
/dev/sda3     ext3    487M   11M  451M   3% /home
tmpfs        tmpfs    506M     0  506M   0% /dev/shm
/dev/hdc   iso9660    3.9G  3.9G     0 100% /media/CentOS_5.5_Final
172.16.6.220:/share
               nfs     36G  5.0G   29G  15% /mnt/server
[root@linux120 ~]# df -h -t nfs
Filesystem    Type    Size  Used Avail Use% Mounted on
172.16.6.220:/share
               nfs     36G  5.0G   29G  15% /mnt/server
[root@linux120 ~]# cd /mnt/server
[root@linux120 /mnt/server]# ls -l
total 0
-rw-r--r-- 1 root root 0 May 10 18:20 testfile.txt
[root@linux120 /mnt/server]# mkdir dir1
mkdir: cannot create directory `dir1': Permission denied
[root@linux120 /mnt/server]# echo 1111 >> testfile.txt
bash: testfile.txt: Permission denied
[root@linux120 /mnt/server]#


[S]

[root@linux220 ~]# chmod 777 /share
[root@linux220 ~]# ls -ld /share
drwxrwxrwx 2 root root 4.0K May 10 18:20 /share
[root@linux220 ~]#


[C]

[root@linux120 /mnt/server]# touch linux120.txt
[root@linux120 /mnt/server]# mkdir linux120
[root@linux120 /mnt/server]# ls -l
total 4.0K
drwxr-xr-x 2 nfsnobody nfsnobody 4.0K May 10 18:29 linux120
-rw-r--r-- 1 nfsnobody nfsnobody    0 May 10 18:29 linux120.txt
-rw-r--r-- 1 root      root         0 May 10 18:20 testfile.txt
[root@linux120 /mnt/server]#


[S]

[root@linux220 ~]# vi /etc/exports
[root@linux220 ~]# cat /etc/exports
#
# (1) NFS Server Test
#
/share                  172.16.0.0/255.255.0.0(rw,no_root_squash)
[root@linux220 ~]# service nfs restart
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@linux220 ~]# exportfs -v
/share          172.16.0.0/255.255.0.0(rw,wdelay,no_root_squash,no_subtree_check,anonuid=65534,anongid=65534)
[root@linux220 ~]#


[C]

[root@linux120 /mnt/server]# touch centos120.txt
[root@linux120 /mnt/server]# mkdir centos120
[root@linux120 /mnt/server]# ls -l
total 8.0K
drwxr-xr-x 2 root      root      4.0K May 10 18:31 centos120
-rw-r--r-- 1 root      root         0 May 10 18:31 centos120.txt
drwxr-xr-x 2 nfsnobody nfsnobody 4.0K May 10 18:29 linux120
-rw-r--r-- 1 nfsnobody nfsnobody    0 May 10 18:29 linux120.txt
-rw-r--r-- 1 root      root         0 May 10 18:20 testfile.txt
[root@linux120 /mnt/server]#

[root@linux120 /mnt/server]# cd
[root@linux120 ~]# umount /mnt/server/
[root@linux120 ~]# df -h
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext3     36G  5.0G   29G  15% /
/dev/sda8     ext3    487M   11M  451M   3% /data1
/dev/sda7     ext3    487M   11M  451M   3% /data2
/dev/sda6     ext3    487M   11M  451M   3% /data3
/dev/sda5     ext3    487M   11M  451M   3% /data4
/dev/sda3     ext3    487M   11M  451M   3% /home
tmpfs        tmpfs    506M     0  506M   0% /dev/shm
/dev/hdc   iso9660    3.9G  3.9G     0 100% /media/CentOS_5.5_Final



[C]

[root@linux120 ~]# man ls
[root@linux120 ~]# cd /usr/share
[root@linux120 /usr/share]# mv man man.old
[root@linux120 /usr/share]# man ls
No manual entry for ls
[root@linux120 /usr/share]#


[S]

[root@linux220 ~]# vi /etc/exports
[root@linux220 ~]# cat /etc/exports
#
# (1) NFS Server Test
#
/share                  172.16.0.0/255.255.0.0(rw,no_root_squash)
#
# (2) MAN Page Server Test
#
/usr/share/man  172.16.0.0/255.255.0.0(ro)
[root@linux220 ~]# service nfs restart
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@linux220 ~]# exportfs
/usr/share/man  172.16.0.0/255.255.0.0
/share          172.16.0.0/255.255.0.0
[root@linux220 ~]# exportfs -v
/usr/share/man  172.16.0.0/255.255.0.0(ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/share          172.16.0.0/255.255.0.0(rw,wdelay,no_root_squash,no_subtree_check,anonuid=65534,anongid=65534)
[root@linux220 ~]#


[C]

[root@linux120 /usr/share]# showmount -e 172.16.6.220
Export list for 172.16.6.220:
/share         172.16.0.0/255.255.0.0
/usr/share/man 172.16.0.0/255.255.0.0
[root@linux120 /usr/share]# mkdir /usr/share/man
[root@linux120 /usr/share]# mount 172.16.6.220:/usr/share/man /usr/share/man
[root@linux120 /usr/share]# df -h -t nfs
Filesystem    Type    Size  Used Avail Use% Mounted on
172.16.6.220:/usr/share/man
               nfs     36G  5.0G   29G  15% /usr/share/man
[root@linux120 /usr/share]# man ls
[root@linux120 /usr/share]# ls /usr/share/man
bg  en            fr.UTF-8  it.ISO8859-1  man1   man3   man5   man7x  mann          pt         ru.UTF-8  zh_CN
cs  es            hr        it.UTF-8      man1p  man3p  man5x  man8   nl            pt_BR      sk        zh_TW
da  fi            hu        ja            man1x  man3x  man6   man8x  pl            ro         sl
de  fr            id        ko            man2   man4   man6x  man9   pl.ISO8859-2  ru         sv
el  fr.ISO8859-1  it        man0p         man2x  man4x  man7   man9x  pl.UTF-8      ru.KOI8-R  tr
[root@linux120 /usr/share]#
[root@linux120 /usr/share]#
[root@linux120 /usr/share]#
[root@linux120 /usr/share]# cd
[root@linux120 ~]# umount /usr/share/man
[root@linux120 ~]# cd /usr/share
[root@linux120 /usr/share]# rmdir man
[root@linux120 /usr/share]# mv man.old man
[root@linux120 /usr/share]# man ls
[root@linux120 /usr/share]#




[S]

[root@linux220 ~]# mkdir -p /export/home
[root@linux220 ~]# useradd -u 3000 -g 100 -d /export/home/nfsuser nfsuser
[root@linux220 ~]# passwd nfsuser
Changing password for user nfsuser.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@linux220 ~]# vi /etc/exports
[root@linux220 ~]# cat /etc/exports
#
# (1) NFS Server Test
#
/share                  172.16.0.0/255.255.0.0(rw,no_root_squash)
#
# (2) MAN Page Server Test
#
/usr/share/man  172.16.0.0/255.255.0.0(ro)
#
# (3) Home Directory Server Test
#
/export/home    172.16.0.0/255.255.0.0(rw)
[root@linux220 ~]# service nfs restart
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
xStarting RPC idmapd:                                      [  OK  ]
[root@linux220 ~]# exportfs -v
/usr/share/man  172.16.0.0/255.255.0.0(ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/export/home    172.16.0.0/255.255.0.0(rw,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/share          172.16.0.0/255.255.0.0(rw,wdelay,no_root_squash,no_subtree_check,anonuid=65534,anongid=65534)
[root@linux220 ~]# su - nfsuser
[nfsuser@linux220 ~]$ pwd
/export/home/nfsuser
[nfsuser@linux220 ~]$ touch README_nfsuser
[nfsuser@linux220 ~]$ ls -l README_nfsuser
-rw-r--r-- 1 nfsuser users 0 May 10 18:48 README_nfsuser
[nfsuser@linux220 ~]$ tail -f README_nfsuser
linux220


[C]

[root@linux120 ~]# useradd -u 3000 -g 100 -M nfsuser
[root@linux120 ~]# passwd nfsuser
Changing password for user nfsuser.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@linux120 ~]# showmount -e 172.16.6.220
Export list for 172.16.6.220:
/share         172.16.0.0/255.255.0.0
/export/home   172.16.0.0/255.255.0.0
/usr/share/man 172.16.0.0/255.255.0.0
[root@linux120 ~]# mkdir /home/nfsuser
[root@linux120 ~]# mkdir -p /home/nfsuser
[root@linux120 ~]# chown nfsuser:users /home/nfsuser
[root@linux120 ~]# mount 172.16.6.220:/export/home/nfsuser /home/nfsuser
[root@linux120 ~]# df -h -t nfs
Filesystem    Type    Size  Used Avail Use% Mounted on
172.16.6.220:/export/home/nfsuser
               nfs     36G  5.0G   29G  15% /home/nfsuser
[root@linux120 ~]# telnet localhost
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.

    linux120.example.com (Linux release 2.6.18-409.el5 #1 SMP Tue Mar 15 18:22:22 EDT 2016) (1)

login: nfsuser
Password:
[nfsuser@linux120 ~]$ id
uid=3000(nfsuser) gid=100(users) groups=100(users)
[nfsuser@linux120 ~]$ pwd
/home/nfsuser
[nfsuser@linux120 ~]$ ls -l
total 0
-rw-r--r-- 1 nfsuser users 0 May 10 18:48 README_nfsuser
[nfsuser@linux120 ~]$ echo linux220 >> README_nfsuser
[nfsuser@linux120 ~]$ cat README_nfsuser
linux220
[nfsuser@linux120 ~]$ exit
logout

Connection closed by foreign host.
[root@linux120 ~]# cd
[root@linux120 ~]# umount /home/nfsuser/
[root@linux120 ~]# showmount -e 172.16.6.220
Export list for 172.16.6.220:
/share         172.16.0.0/255.255.0.0
/export/home   172.16.0.0/255.255.0.0
/usr/share/man 172.16.0.0/255.255.0.0
[root@linux120 ~]# showmount -e 172.16.6.249
Export list for 172.16.6.249:
/share         172.16.0.0/255.255.0.0
/export/home   172.16.0.0/255.255.0.0
/usr/share/man 172.16.0.0/255.255.0.0
[root@linux120 ~]# mount 172.16.6.249:/export/home/nfsuser /home/nfsuser
[root@linux120 ~]# df -h -t nfs
Filesystem    Type    Size  Used Avail Use% Mounted on
172.16.6.249:/export/home/nfsuser
               nfs     36G  4.9G   29G  15% /home/nfsuser
[root@linux120 ~]# telnet localhost
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.

    linux120.example.com (Linux release 2.6.18-409.el5 #1 SMP Tue Mar 15 18:22:22 EDT 2016) (1)

nlogin:nfsuser
Password:
Last login: Tue May 10 18:52:18 from localhost.localdomain
[nfsuser@linux120 ~]$ ls -l
total 4
-rw-r--r-- 1 nfsuser users 27 May 10 18:54 README_nfsuser
[nfsuser@linux120 ~]$ echo linux220 >> README_nfsuser
[nfsuser@linux120 ~]$ cat README_nfsuser
linux249
linux200
linux221
linux220
[nfsuser@linux120 ~]$


[S]

[root@linux220 ~]# df -h
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext3     36G  5.0G   29G  15% /
/dev/sda8     ext3    487M   11M  451M   3% /data1
/dev/sda7     ext3    487M   11M  451M   3% /data2
/dev/sda6     ext3    487M   11M  451M   3% /data3
/dev/sda5     ext3    487M   11M  451M   3% /data4
/dev/sda3     ext3    487M   11M  451M   3% /home
tmpfs        tmpfs    506M     0  506M   0% /dev/shm
/dev/hdc   iso9660    3.9G  3.9G     0 100% /media/CentOS_5.5_Final
[root@linux220 ~]# vi /etc/exports
[root@linux220 ~]# cat /etc/exports
#
# (1) NFS Server Test
#
/share                  172.16.0.0/255.255.0.0(rw,no_root_squash)
#
# (2) MAN Page Server Test
#
/usr/share/man  172.16.0.0/255.255.0.0(ro)
#
# (3) Home Directory Server Test
#
/export/home    172.16.0.0/255.255.0.0(rw)
#
# (4) CD/DVD Share Test
#
/media/CentOS_5.5_Final         172.16.0.0/255.255.0.0{ro)
[root@linux220 ~]# service nfs restart
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:  exportfs: No options for /media/CentOS_5.5_Final 172.16.0.0/255.255.0.0{ro): suggest 172.16.0.0/255.255.0.0{ro)(sync) to avoid warning
                                                           [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@linux220 ~]# exportfs -v
/media/CentOS_5.5_Final
                172.16.0.0/255.255.0.0{ro)(ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/usr/share/man  172.16.0.0/255.255.0.0(ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/export/home    172.16.0.0/255.255.0.0(rw,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/share          172.16.0.0/255.255.0.0(rw,wdelay,no_root_squash,no_subtree_check,anonuid=65534,anongid=65534)
[root@linux220 ~]# vi /etc/exports
[root@linux220 ~]# service nfs restart
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@linux220 ~]# exportfs -v
/media/CentOS_5.5_Final
                172.16.0.0/255.255.0.0(ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/usr/share/man  172.16.0.0/255.255.0.0(ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/export/home    172.16.0.0/255.255.0.0(rw,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/share          172.16.0.0/255.255.0.0(rw,wdelay,no_root_squash,no_subtree_check,anonuid=65534,anongid=65534)
[root@linux220 ~]#



[C]

[root@linux120 ~]# showmount -e 172.16.6.220
Export list for 172.16.6.220:
/share                  172.16.0.0/255.255.0.0
/export/home            172.16.0.0/255.255.0.0
/usr/share/man          172.16.0.0/255.255.0.0
/media/CentOS_5.5_Final 172.16.0.0/255.255.0.0{ro)
[root@linux120 ~]# showmount -e 172.16.6.220
Export list for 172.16.6.220:
/share                  172.16.0.0/255.255.0.0
/export/home            172.16.0.0/255.255.0.0
/usr/share/man          172.16.0.0/255.255.0.0
/media/CentOS_5.5_Final 172.16.0.0/255.255.0.0
[root@linux120 ~]# mkdir /mnt/cdrom
mkdir: cannot create directory `/mnt/cdrom': File exists
[root@linux120 ~]# mkdir -p /mnt/cdrom
[root@linux120 ~]# mount 172.16.6.220:/media/CentOS_5.5_Final /mnt/cdrom
[root@linux120 ~]# cd /mnt/cdrom/
[root@linux120 /mnt/cdrom]# ls
CentOS    RELEASE-NOTES-cs       RELEASE-NOTES-en_US       RELEASE-NOTES-ja          RELEASE-NOTES-ro
EULA      RELEASE-NOTES-cs.html  RELEASE-NOTES-en_US.html  RELEASE-NOTES-ja.html     RELEASE-NOTES-ro.html
GPL       RELEASE-NOTES-de       RELEASE-NOTES-es          RELEASE-NOTES-nl          repodata
images    RELEASE-NOTES-de.html  RELEASE-NOTES-es.html     RELEASE-NOTES-nl.html     RPM-GPG-KEY-beta
isolinux  RELEASE-NOTES-en       RELEASE-NOTES-fr          RELEASE-NOTES-pt_BR       RPM-GPG-KEY-CentOS-5
NOTES     RELEASE-NOTES-en.html  RELEASE-NOTES-fr.html     RELEASE-NOTES-pt_BR.html  TRANS.TBL
[root@linux120 /mnt/cdrom]# cd CentOS/
[root@linux120 /mnt/cdrom/CentOS]# ls lynx*
lynx-2.8.5-28.1.el5_2.1.i386.rpm
[root@linux120 /mnt/cdrom/CentOS]# rpm -Uvh lynx*
Preparing...                ########################################### [100%]
        package lynx-2.8.5-28.1.el5_2.1.i386 is already installed
[root@linux120 /mnt/cdrom/CentOS]# rpm -qa | grep lynx
lynx-2.8.5-28.1.el5_2.1
[root@linux120 /mnt/cdrom/CentOS]#


[root@linux120 /mnt/cdrom/CentOS]# cd
[root@linux120 ~]# umount /home/nfsuser/
[root@linux120 ~]# userdel -r nfsuser
[root@linux120 ~]#

[root@linux120 ~]# df -h
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext3     36G  5.0G   29G  15% /
/dev/sda8     ext3    487M   11M  451M   3% /data1
/dev/sda7     ext3    487M   11M  451M   3% /data2
/dev/sda6     ext3    487M   11M  451M   3% /data3
/dev/sda5     ext3    487M   11M  451M   3% /data4
/dev/sda3     ext3    487M   11M  451M   3% /home
tmpfs        tmpfs    506M     0  506M   0% /dev/shm
/dev/hdc   iso9660    3.9G  3.9G     0 100% /media/CentOS_5.5_Final
172.16.6.220:/media/CentOS_5.5_Final
               nfs    3.9G  3.9G     0 100% /mnt/cdrom
[root@linux120 ~]# umount /mnt/cdrom
[root@linux120 ~]# df -h -t nfs
Filesystem    Type    Size  Used Avail Use% Mounted on
[root@linux120 ~]#





[S]

[root@linux220 ~]# showmount -e 172.16.6.252
Export list for 172.16.6.252:
/nfstest                   172.16.0.0/16
/export/centos             172.16.0.0/16
/backup/linux240           172.16.6.240
/backup/linux239           172.16.6.239
/backup/linux238           172.16.6.238
/backup/linux237           172.16.6.237
/backup/linux236           172.16.6.236
/backup/linux235           172.16.6.235
/backup/linux234           172.16.6.234
/backup/linux233           172.16.6.233
/backup/linux232           172.16.6.232
/backup/linux231           172.16.6.231
/backup/linux230           172.16.6.230
/backup/linux229           172.16.6.229
/backup/linux228           172.16.6.228
/backup/linux227           172.16.6.227
/backup/linux226           172.16.6.226
/backup/linux225           172.16.6.225
/backup/linux224           172.16.6.224
/backup/linux223           172.16.6.223
/backup/linux222           172.16.6.222
/backup/linux221           172.16.6.221
/backup/linux220           172.16.6.220
/backup/linux219           172.16.6.219
/backup/linux218           172.16.6.218
/backup/linux217           172.16.6.217
/backup/linux216           172.16.6.216
/backup/linux215           172.16.6.215
/backup/linux214           172.16.6.214
/backup/linux213           172.16.6.213
/backup/linux212           172.16.6.212
/backup/linux211           172.16.6.211
/backup/linux210           172.16.6.210
/backup/linux209           172.16.6.209
/backup/linux208           172.16.6.208
/backup/linux207           172.16.6.207
/backup/linux206           172.16.6.206
/backup/linux205           172.16.6.205
/backup/linux204           172.16.6.204
/backup/linux203           172.16.6.203
/backup/linux202           172.16.6.202
/backup/linux201           172.16.6.201
/backup/linux200           172.16.6.200
/root/packages/vmwaretools 172.16.0.0/16
[root@linux220 ~]# rm -rf /backup ; mkdir -p /backup
[root@linux220 ~]# mount 172.16.6.252:/backup/linux220 /backup
[root@linux220 ~]# df -h -t nfs
Filesystem    Type    Size  Used Avail Use% Mounted on
172.16.6.252:/backup/linux220
               nfs     18G   12G  5.4G  69% /backup
[root@linux220 ~]# tar cvzf /backup/home.tar.gz /home
tar: Removing leading `/' from member names
/home/
/home/499
/home/user01/
/home/user01/file2
/home/user01/file3
/home/user01/file4
/home/user01/.bash_history
/home/user01/.emacs
/home/user01/.bash_profile
/home/user01/mail/
/home/user01/mail/.imap/
/home/user01/mail/.imap/INBOX/
/home/user01/mail/.imap/INBOX/dovecot.index.cache
/home/user01/mail/.imap/INBOX/dovecot.index
/home/user01/mail/.imap/INBOX/dovecot.index.log
/home/user01/.bashrc
/home/user01/.bash_logout
/home/user01/.mozilla/
/home/user01/.mozilla/plugins/
/home/user01/.mozilla/extensions/
/home/user01/file1
/home/lost+found/
/home/mail01/
/home/mail01/.bash_history
/home/mail01/.emacs
/home/mail01/.bash_profile
/home/mail01/.bashrc
/home/mail01/.bash_logout
/home/mail01/.mozilla/
/home/mail01/.mozilla/plugins/
/home/mail01/.mozilla/extensions/
/home/user03/
/home/user03/.bash_history
/home/user03/.emacs
/home/user03/.bash_profile
/home/user03/.bashrc
/home/user03/.bash_logout
/home/user03/.mozilla/
/home/user03/.mozilla/plugins/
/home/user03/.mozilla/extensions/
/home/user02/
/home/user02/.emacs
/home/user02/.bash_profile
/home/user02/.bashrc
/home/user02/.bash_logout
/home/user02/.mozilla/
/home/user02/.mozilla/plugins/
/home/user02/.mozilla/extensions/
/home/mail02/
/home/mail02/.bash_history
/home/mail02/.emacs
/home/mail02/.bash_profile
/home/mail02/.bashrc
/home/mail02/.bash_logout
/home/mail02/.mozilla/
/home/mail02/.mozilla/plugins/
/home/mail02/.mozilla/extensions/
/home/team01/
/home/team01/.emacs
/home/team01/.bash_profile
/home/team01/.bashrc
/home/team01/.bash_logout
/home/team01/.mozilla/
/home/team01/.mozilla/plugins/
/home/team01/.mozilla/extensions/
/home/fedora/
/home/fedora/.sh_history
/home/fedora/.bash_history
/home/fedora/.bash_profile
/home/fedora/mail/
/home/fedora/mail/Trash
/home/fedora/mail/Sent
/home/fedora/mail/.subscriptions
/home/fedora/mail/.imap/
/home/fedora/mail/.imap/Trash/
/home/fedora/mail/.imap/Trash/dovecot.index.cache
/home/fedora/mail/.imap/Trash/dovecot.index
/home/fedora/mail/.imap/Trash/dovecot.index.log
/home/fedora/mail/.imap/INBOX/
/home/fedora/mail/.imap/INBOX/dovecot.index.cache
/home/fedora/mail/.imap/INBOX/dovecot.index
/home/fedora/mail/.imap/INBOX/dovecot.index.log
/home/fedora/mail/Drafts
/home/fedora/.bashrc
/home/fedora/.bash_logout
/home/fedora/.mozilla/
/home/fedora/.mozilla/plugins/
/home/fedora/.mozilla/extensions/
/home/team02/
/home/team02/.emacs
/home/team02/.bash_profile
/home/team02/.bashrc
/home/team02/.bash_logout
/home/team02/.mozilla/
/home/team02/.mozilla/plugins/
/home/team02/.mozilla/extensions/
[root@linux220 ~]# ls -l /backup
total 8.0K
-rw-r--r-- 1 root root 6.9K May 10 20:13 home.tar.gz
[root@linux220 ~]# ssh 172.16.6.252 ls -R /backup
The authenticity of host '172.16.6.252 (172.16.6.252)' can't be established.
RSA key fingerprint is e2:f0:f8:a2:47:3b:b4:7c:ae:65:38:0e:31:bf:1f:84.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.6.252' (RSA) to the list of known hosts.
root@172.16.6.252's password:
/backup:
linux200
linux201
linux202
linux203
linux204
linux205
linux206
linux207
linux208
linux209
linux210
linux211
linux212
linux213
linux214
linux215
linux216
linux217
linux218
linux219
linux220
linux221
linux222
linux223
linux224
linux225
linux226
linux227
linux228
linux229
linux230
linux231
linux232
linux233
linux234
linux235
linux236
linux237
linux238
linux239
linux240

/backup/linux200:
home.tar.gz

/backup/linux201:

/backup/linux202:
home.tar.gz

/backup/linux203:

/backup/linux204:
home.tar.gz

/backup/linux205:
home.tar.gz

/backup/linux206:

/backup/linux207:

/backup/linux208:
home.tar.gz

/backup/linux209:
home.tar.gz

/backup/linux210:
home.tar.gz

/backup/linux211:
home.tar.gz

/backup/linux212:
home.tar.gz

/backup/linux213:
home.tar.gz

/backup/linux214:

/backup/linux215:
backup.log
home,
home.tar.gz

/backup/linux216:
home.tar.gz

/backup/linux217:
home.tar.gz

/backup/linux218:
home.tar.gz

/backup/linux219:

/backup/linux220:
home.tar.gz

/backup/linux221:

/backup/linux222:

/backup/linux223:

/backup/linux224:
home.tar.gz

/backup/linux225:

/backup/linux226:
home.tar.gz

/backup/linux227:
home.tar.gz

/backup/linux228:
home.tar.gz

/backup/linux229:
home.tar.gz

/backup/linux230:

/backup/linux231:

/backup/linux232:

/backup/linux233:

/backup/linux234:

/backup/linux235:

/backup/linux236:

/backup/linux237:

/backup/linux238:

/backup/linux239:

/backup/linux240:
[root@linux220 ~]#




[SMB]

[root@linux220 ~]# egrep '(netbios|microsoft-ds)' /etc/services
netbios-ns      137/tcp                         # NETBIOS Name Service
netbios-ns      137/udp
netbios-dgm     138/tcp                         # NETBIOS Datagram Service
netbios-dgm     138/udp
netbios-ssn     139/tcp                         # NETBIOS session service
netbios-ssn     139/udp
microsoft-ds    445/tcp
microsoft-ds    445/udp
[root@linux220 ~]# cd /etc/samba
[root@linux220 /etc/samba]# ls
lmhosts  smb.conf  smbusers
[root@linux220 /etc/samba]# chkconfig smb on
[root@linux220 /etc/samba]# service smb restart
Shutting down SMB services:                                [FAILED]
Shutting down NMB services:                                [FAILED]
Starting SMB services:                                     [  OK  ]
Starting NMB services:                                     [  OK  ]
[root@linux220 /etc/samba]# pgrep -lf nmbd
18202 nmbd -D
[root@linux220 /etc/samba]# pgrep -lf smbd
18198 smbd -D
18201 smbd -D
[root@linux220 /etc/samba]# cat lmhosts
127.0.0.1 localhost
[root@linux220 /etc/samba]# cat smbusers
# Unix_name = SMB_name1 SMB_name2 ...
root = administrator admin
nobody = guest pcguest smbguest
[root@linux220 /etc/samba]# vi smb.conf
[root@linux220 /etc/samba]#


[root@linux220 /etc/samba]# cd
[root@linux220 ~]# smbclient -L 172.16.6.252
Password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.33-3.41.el5_11]

        Sharename       Type      Comment
        ---------       ----      -------
        docs            Disk      Documentation Directory
        public          Disk      Samba Test
        IPC$            IPC       IPC Service (Samba Server(linux252) Version 3.0.33-3.41.el5_11)
        Microsoft_XPS_Document_Writer:1 Printer   Microsoft XPS Document Writer
        Microsoft_XPS_Document_Writer(_2):9 Printer   Microsoft XPS Document Writer( 2)
        Microsoft_XPS_Document_Writer(_2):8 Printer   Foxit PhantomPDF Printer( 2)
        Microsoft_XPS_Document_Writer(_2):11 Printer   Fax( 2)
        Microsoft_XPS_Document_Writer(_2):10 Printer   Adobe PDF( 2)
        Microsoft_XPS_Document_Writer(_1):10 Printer   Microsoft XPS Document Writer( 2)
        Hancom_PDF:4    Printer   Adobe PDF
        Hancom_PDF:2    Printer   Hancom PDF
        Hancom_PDF(_2):9 Printer   Hancom PDF( 2)
        Hancom_PDF(_2):12 Printer   Hancom PDF( 2)
        Hancom_PDF(_2):11 Printer   Hancom PDF( 2)
        Hancom_PDF(_2):10 Printer   Hancom PDF( 2)
        Hancom_PDF(_1):9 Printer   Microsoft XPS Document Writer( 2)
        Haansoft_PDF:2  Printer   Haansoft PDF
        Foxit_PhantomPDF_Printer:6 Printer   Foxit PhantomPDF Printer
        Foxit_PhantomPDF_Printer(_2):9 Printer   Foxit PhantomPDF Printer( 2)
        Foxit_PhantomPDF_Printer(_2):8 Printer   Foxit PhantomPDF Printer( 2)
        Foxit_PhantomPDF_Printer(_2):12 Printer   Foxit PhantomPDF Printer( 2)
        Foxit_PhantomPDF_Printer(_2):11 Printer   Foxit PhantomPDF Printer( 2)
        Fax:3           Printer   Fax
        Fax(_2):9       Printer   Fax( 2)
        Fax(_2):8       Printer   Fax( 2)
        Fax(_2):12      Printer   Fax( 2)
        Fax(_2):11      Printer   Fax( 2)
        Fax(_2):10      Printer   Fax( 2)
        Fax(_1):8       Printer   Fax( 1)
        doPDF_v7:7      Printer   Canon iR2200-3300 PCL
        doPDF_v7:5      Printer   doPDF v7
        Canon_iR2200-3300_PS3:5 Printer   Canon iR2200-3300 PS3
        Canon_iR2200-3300_PCL:7 Printer   Canon iR2200-3300 PCL
        Adobe_PDF:6     Printer   Adobe PDF
        Adobe_PDF:4     Printer   Adobe PDF
        Adobe_PDF(_2):9 Printer   Adobe PDF( 2)
        Adobe_PDF(_2):8 Printer   Adobe PDF( 2)
        Adobe_PDF(_2):11 Printer   Adobe PDF( 2)
        Adobe_PDF(_2):10 Printer   Adobe PDF( 2)
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.33-3.41.el5_11]

        Server               Comment
        ---------            -------
        LINUX252             Samba Server(linux252) Version 3.0.33-3.41.el5_1

        Workgroup            Master
        ---------            -------
        WORKGROUP           
[root@linux220 ~]# smbclient -L 172.16.6.252 -N
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.33-3.41.el5_11]

        Sharename       Type      Comment
        ---------       ----      -------
        docs            Disk      Documentation Directory
        public          Disk      Samba Test
        IPC$            IPC       IPC Service (Samba Server(linux252) Version 3.0.33-3.41.el5_11)
        Microsoft_XPS_Document_Writer:1 Printer   Microsoft XPS Document Writer
        Microsoft_XPS_Document_Writer(_2):9 Printer   Microsoft XPS Document Writer( 2)
        Microsoft_XPS_Document_Writer(_2):8 Printer   Foxit PhantomPDF Printer( 2)
        Microsoft_XPS_Document_Writer(_2):11 Printer   Fax( 2)
        Microsoft_XPS_Document_Writer(_2):10 Printer   Adobe PDF( 2)
        Microsoft_XPS_Document_Writer(_1):10 Printer   Microsoft XPS Document Writer( 2)
        Hancom_PDF:4    Printer   Adobe PDF
        Hancom_PDF:2    Printer   Hancom PDF
        Hancom_PDF(_2):9 Printer   Hancom PDF( 2)
        Hancom_PDF(_2):12 Printer   Hancom PDF( 2)
        Hancom_PDF(_2):11 Printer   Hancom PDF( 2)
        Hancom_PDF(_2):10 Printer   Hancom PDF( 2)
        Hancom_PDF(_1):9 Printer   Microsoft XPS Document Writer( 2)
        Haansoft_PDF:2  Printer   Haansoft PDF
        Foxit_PhantomPDF_Printer:6 Printer   Foxit PhantomPDF Printer
        Foxit_PhantomPDF_Printer(_2):9 Printer   Foxit PhantomPDF Printer( 2)
        Foxit_PhantomPDF_Printer(_2):8 Printer   Foxit PhantomPDF Printer( 2)
        Foxit_PhantomPDF_Printer(_2):12 Printer   Foxit PhantomPDF Printer( 2)
        Foxit_PhantomPDF_Printer(_2):11 Printer   Foxit PhantomPDF Printer( 2)
        Fax:3           Printer   Fax
        Fax(_2):9       Printer   Fax( 2)
        Fax(_2):8       Printer   Fax( 2)
        Fax(_2):12      Printer   Fax( 2)
        Fax(_2):11      Printer   Fax( 2)
        Fax(_2):10      Printer   Fax( 2)
        Fax(_1):8       Printer   Fax( 1)
        doPDF_v7:7      Printer   Canon iR2200-3300 PCL
        doPDF_v7:5      Printer   doPDF v7
        Canon_iR2200-3300_PS3:5 Printer   Canon iR2200-3300 PS3
        Canon_iR2200-3300_PCL:7 Printer   Canon iR2200-3300 PCL
        Adobe_PDF:6     Printer   Adobe PDF
        Adobe_PDF:4     Printer   Adobe PDF
        Adobe_PDF(_2):9 Printer   Adobe PDF( 2)
        Adobe_PDF(_2):8 Printer   Adobe PDF( 2)
        Adobe_PDF(_2):11 Printer   Adobe PDF( 2)
        Adobe_PDF(_2):10 Printer   Adobe PDF( 2)
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.33-3.41.el5_11]

        Server               Comment
        ---------            -------
        LINUX252             Samba Server(linux252) Version 3.0.33-3.41.el5_1

        Workgroup            Master
        ---------            -------
        WORKGROUP           
[root@linux220 ~]# smbclient //172.16.6.252/public
Password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.33-3.41.el5_11]
Server not using user level security and no password supplied.
smb: \> ?
?              altname        archive        blocksize      cancel        
case_sensitive cd             chmod          chown          close         
del            dir            du             exit           get           
getfacl        hardlink       help           history        lcd           
link           lock           lowercase      ls             mask          
md             mget           mkdir          more           mput          
newer          open           posix          posix_open     posix_mkdir   
posix_rmdir    posix_unlink   print          prompt         put           
pwd            q              queue          quit           rd            
recurse        reget          rename         reput          rm            
rmdir          showacls       setmode        stat           symlink       
tar            tarmode        translate      unlock         volume        
vuid           wdel           logon          listconnect    showconnect   
!             
smb: \> dir
  .                                   D        0  Sun Sep 20 15:19:44 2015
  ..                                  D        0  Tue May 10 13:11:59 2016
  WelcomToMyServer.txt                         0  Wed Mar 19 19:43:53 2014
  passwd                                    2461  Sun Sep 20 15:19:28 2015
  WelcomeToMyServer.txt                        0  Sun Sep 20 15:19:44 2015

                36701 blocks of size 524288. 10552 blocks available
smb: \> lcd /tmp
smb: \> mget passwd
Get file passwd? y
getting file \passwd of size 2461 as passwd (400.5 kb/s) (average 400.6 kb/s)
smb: \> quit
[root@linux220 ~]# ls -l /tmp/passwd
-rw-r--r-- 1 root root 2.5K May 10 21:14 /tmp/passwd
[root@linux220 ~]# smbclient //172.16.6.252/public -U root
Password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.33-3.41.el5_11]
Server not using user level security and no password supplied.
smb: \> dir
  .                                   D        0  Sun Sep 20 15:19:44 2015
  ..                                  D        0  Tue May 10 13:11:59 2016
  WelcomToMyServer.txt                         0  Wed Mar 19 19:43:53 2014
  passwd                                    2461  Sun Sep 20 15:19:28 2015
  WelcomeToMyServer.txt                        0  Sun Sep 20 15:19:44 2015

                36701 blocks of size 524288. 10552 blocks available
smb: \> quit
[root@linux220 ~]# smbstatus

Samba version 3.0.33-3.41.el5_11
PID     Username      Group         Machine                       
-------------------------------------------------------------------

Service      pid     machine       Connected at
-------------------------------------------------------

No locked files

[root@linux220 ~]# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        workgroup = MYGROUP
        server string = Samba Server Version %v
        passdb backend = tdbsam
        cups options = raw

[homes]
        comment = Home Directories
        read only = No
        browseable = No

[printers]
        comment = All Printers
        path = /var/spool/samba
        printable = Yes
        browseable = No
[root@linux220 ~]# cd /etc/samba/
[root@linux220 /etc/samba]# cp smb.conf smb.conf.orig
[root@linux220 /etc/samba]# testparm smb.conf.orig
Load smb config files from smb.conf.orig
Processing section "[homes]"
Processing section "[printers]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        workgroup = MYGROUP
        server string = Samba Server Version %v
        passdb backend = tdbsam
        cups options = raw

[homes]
        comment = Home Directories
        read only = No
        browseable = No

[printers]
        comment = All Printers
        path = /var/spool/samba
        printable = Yes
        browseable = No
[root@linux220 /etc/samba]#
[root@linux220 /etc/samba]#



[root@linux220 /etc/samba]# vi ~/.bashrc
[root@linux220 /etc/samba]# cat ~/.bashrc | tail -13
#
# Mail Alias
#
alias MAIL='cd /etc/mail'
alias sendmail.cf='vi /etc/mail/sendmail.cf'
alias mlog='tail -f /var/log/maillog'
#
# Samba Alias
#
alias smb.conf='vi /etc/samba/smb.conf'
alias SMB='cd /etc/samba'
alias smblog='tail –f /var/log/samba/smbd.log'
alias nmblog='tail -f /var/log/samba/nmbd.log'
[root@linux220 /etc/samba]# . ~/.bashrc
[root@linux220 /etc/samba]# cd
[root@linux220 ~]# SMB
[root@linux220 /etc/samba]# vi /smb.conf
[root@linux220 /etc/samba]# ls
lmhosts  passdb.tdb  secrets.tdb  smb.conf  smb.conf.orig  smbusers
[root@linux220 /etc/samba]# vi smb.conf.orig
[root@linux220 /etc/samba]# vi smb.conf
[root@linux220 /etc/samba]# cat smb.conf | tail -10
#
# Specific Configuration
#
[public]
                comment = Samba Test
                path = /samba
                public = yes
                writable = yes
                printable = no

[root@linux220 /etc/samba]# mkdir /samba
[root@linux220 /etc/samba]# chmod 777 /samba
[root@linux220 /etc/samba]# cp /etc/passwd /samba
[root@linux220 /etc/samba]# service smb restart
Shutting down SMB services:                                [  OK  ]
Shutting down NMB services:                                [  OK  ]
Starting SMB services:                                     [  OK  ]
Starting NMB services:                                     [  OK  ]
[root@linux220 /etc/samba]# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[public]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        server string = Samba Server linux220
        security = SHARE
        passdb backend = tdbsam
        hosts allow = 127., 172.16., 192.168.10.
        cups options = raw

[homes]
        comment = Home Directories
        read only = No
        browseable = No

[printers]
        comment = All Printers
        path = /var/spool/samba
        printable = Yes
        browseable = No

[public]
        comment = Samba Test
        path = /samba
        read only = No
        guest ok = Yes
[root@linux220 /etc/samba]# smbclient -L localhost -U root
Password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.33-3.41.el5_11]

        Sharename       Type      Comment
        ---------       ----      -------
        public          Disk      Samba Test
        IPC$            IPC       IPC Service (Samba Server linux220)
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.33-3.41.el5_11]

        Server               Comment
        ---------            -------
        LINUX220             Samba Server linux220

        Workgroup            Master
        ---------            -------
        WORKGROUP           
[root@linux220 /etc/samba]#


그림5
그림6
그림7
그림8



[root@linux220 /etc/samba]# cd
[root@linux220 ~]# mkdir -p /mnt/server
[root@linux220 ~]# mount -t cifs 172.16.6.31:samba_share /mnt/server -o user=soldeskN
Password:
[root@linux220 ~]# df -h
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext3     36G  5.0G   29G  15% /
/dev/sda8     ext3    487M   11M  451M   3% /data1
/dev/sda7     ext3    487M   11M  451M   3% /data2
/dev/sda6     ext3    487M   11M  451M   3% /data3
/dev/sda5     ext3    487M   11M  451M   3% /data4
/dev/sda3     ext3    487M   11M  451M   3% /home
tmpfs        tmpfs    506M     0  506M   0% /dev/shm
/dev/hdc   iso9660    3.9G  3.9G     0 100% /media/CentOS_5.5_Final
172.16.6.31:samba_share
              cifs    234G   64G  171G  27% /mnt/server
[root@linux220 ~]# cd /mnt/server
[root@linux220 /mnt/server]# ls
20090330_5.pdf
[root@linux220 /mnt/server]# cp /etc/passwd file1.txt
[root@linux220 /mnt/server]# cp /etc/hosts file2.txt
[root@linux220 /mnt/server]# cp /etc/group file3.txt
[root@linux220 /mnt/server]# ls
20090330_5.pdf  file1.txt  file2.txt  file3.txt
[root@linux220 /mnt/server]# ls
1111.pdf  2222.pdf  file1.txt  file2.txt  file3.txt
[root@linux220 /mnt/server]#


그림9 ~ 그림15


■ 다른 예
# mount -t cifs 172.16.9.1:samba_share /mnt/server -o user=administrator
# mount -t cifs 172.16.9.1:samba_share /mnt/server -o username=administrator
# mount.cifs 172.16.9.1:samba_share /mnt/server -o user=soldesk
# mount.cifs //172.16.9.1/samba_share /mnt/server -o user=soldesk


[참고]  (다른 방법) 윈도우(Windows XP) 공유 자원을 리눅스(Linux CentOS 5.4)에서 접근 하기

(두번째 방법) 바탕화면에서 확인하기
-> "root's Home" 아이콘 더블클릭
-> 새로 뜬 'root' 창에서 'File' 부분 선택
-> "Connect to Server" 선택
-> 새로 뜬 "Connect to Server" 창에서
   Service type : "Windows share" 선택
   Server : <자신 윈도우 서버의 이름>    (예) 172.16.9.X
-> 공유된 자원이 보일것이다.
   바탕화면에 아이콘으로 생성된다.
   다음부터는 바탕화면의 아이콘 클릭하면 된다.

그림16 ~ 그림17


[참고] 부팅시에 SMB 마운트(리눅스 서버에 공유된 자원을 윈도우에서 부팅시에 마운트)

(Windows 쪽에서) "네트워크 드라이브 연결"을 사용
윈도우(Windows XP) 서버에서 네트워크 연결이 되면 자동으로 리눅스 서버(삼바 서버)의 자원을 마운트 할 수 있도록 하기 위해서는 "네트워크 드라이브 연결"을 사용한다.

내컴퓨터 > "네트워크 드라이브 연결"

"Z:", "\\192.168.0.250\public"

그림18


(Linux 쪽에서) /etc/fstab 파일 사용
# vi /etc/fstab

---------------------------------------------------------------------------------------------
#
# (2) SAMBA(CIFS) Mount Test
#
172.16.9.X:samba_share       /mnt/server     cifs    credentials=/etc/samba/cred     0 0
or
//172.16.9.X/samba_share     /mnt/server     cifs    username=soldesk,udi=soldesk,noauto   0 0
---------------------------------------------------------------------------------------------
(참고) # mount -t cifs 172.16.9.X:samba_share /mnt/server -o credentials=/etc/samba/cred

# vi /etc/samba/cred
---------------------------------------------------------------------------------------------
username=soldesk
password=soldesklove
---------------------------------------------------------------------------------------------

# chmod 600 /etc/samba/cred   /* root 사용자만 읽을수 있도록 설정 */
# reboot
l 리눅스 서버가 리부팅되면 자동으로 윈도우 서버의 공유된 자원을 마운트 한다.




















Posted by 22Hz
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함