Linux——linux和windows间共享文件之samba

来源:互联网 发布:微信一键转发源码 编辑:程序博客网 时间:2024/06/13 06:24

1、linux和windows间共享

搭建samba服务器

 

查询是否安装sambaclient

which smbclient

 

安装samba客户端

yum install samba-client

cd /opt

rpm -ivh *.rpm

 

查询samba服务器版本号

rpm -qf /usr/bin/smbclient

 

启动关闭samba服务器

[root@localhost ~]# /etc/init.d/smb start

[root@localhost ~]# /etc/init.d/nmbd start

[root@localhost ~]# /etc/init.d/smb stop

[root@localhost ~]# /etc/init.d/nmbd stop

[root@localhost ~]# /etc/init.d/smb restart

[root@localhost ~]# /etc/init.d/nmbd restart

/usr/sbin/smbd

/usr/sbin/nmbd

 

查杀samba进程服务

pgrep smbd

pkill smbd

pgrep nmbd

pkill nmbd

 

查询windows共享的文件

smbclient -L //192.168.1.120

 

挂载windows共享文件夹

[root@localhost ~]# mkdir /mnt/share
[root@localhost ~]# mount //192.168.n.m/share /mnt/share

ls /mnt/share/

 

mount -t cifs -o username=easwy //windows-server/share /mnt/winshare

smbclient -L //windows-server -U easwy

 

如果Samba服务器配置为user模式

[root@localhost ~]# smbclient -L //192.168.1.3 -U sir01

Password: 请输入用户的密码

share模式;

[root@localhost ~]# smbclient -L //192.168.1.3

Password: 直接按回车

 

相关命令: 

查询IP

ifconfig

 

查询linux系统支持的字符集

locale

 

查看占用的端口

# netstat -tlnp |grep smb

 

防火墙规则清理

[root@localhost ~]# iptables -F

[root@localhost ~]# /sbin/iptables -F

 

vi /etc/samba/lmhosts

127.0.0.1 localhost

192.168.1.6 sxm

 

cat /etc/sysconfig/i18n

LANG="en_US.UTF-8"

 

cd /etc/samba

cp smb.conf smb.conf.raw

vi smb.conf

 

testparm

 

2、linux和linux间共享

NFS服务器