首页 > 代码库 > samba,nfs

samba,nfs

1 nfs

Yum install nfs-utils   -y 

/etc/init.d/rpcbind   start

/etc/init.d/nfs  start

Showmout  -e 

Vi /etc/exports

/mnt               192.168.0.0/24(ro)

Exportfs  -rv

Exportfs  -v

Mount  192.168.0.250:/mnt   /mnt/

2          cifs

yum install samba   samba-client   samba-common -y

/etc/init.d/smb   start 

Smbclient  -L  //192.168.0.250

Smbpasswd -a  admin 

Smbpasswd -a  hello

Pdbedit  -L

Smbclient  -L  //192.168.0.250   -U hello

Cd  /etc/samba/

Ls

Vi  smb.conf更改如下:

              Workgroup  = WESTOS

              Server   string = samba   server  Version  %v

       Security  = shared

       Passdb  backend = tdbsam

 [test]

       Comment= localsystem-mnt

       Path= /mnt

       Public=yes

       Writable= yes

/etc/init.d/smb   reload

Smbclinet  -L   //192.168.0.250/test 如果配置成share,提示输入密码的时候不要输入密码,切记。要不报错:

Server not using user level security and nopassword supplied.

Server requested LANMAN password(share-level security) but ‘client lanman auth = no‘ or ‘client ntlmv2 auth =yes‘

tree connect failed:NT_STATUS_ACCESS_DENIED

Chmod 755  /mnt/

Getsebool -a  | grep  samba

Setsebool  -P  samba_export_all_ro   on

Setenforce 0

samba的主配置文件里

Hosts allow = 192.168.0.254  127.  可以访问的ip

 

1安装samba服务 yum installsamba-client –y yum install samba-common –y

查看samba 共享

Smbclient –L //192.168.0.254 查看254共享出来的samba文件夹。

Mount //192.168.0.254/pub /root/Desktop/pub –o username=guest

2 开机自动挂载:vi /etc/fstab如下:

//192.168.0.254/pub      /root/Desktop/pub         cifs         defaults,uername=guest 0 0

3自动挂载

Yum install autofs –y

/etc/init.d/autofs  start 启动服务

cd 192.168.0.254 自动把254的共享目录pub挂载到本机上了

vi /etc/auto.master 更改如下:

/mnt        /etc/auto.pub

vi /etc/auto.pub 更改如下:

pub         192.168.0.254:/var/ftp/pub

/etc/init.d/autofs  restart 重新启动服务

 

 


samba,nfs