一、下载samba服务器,
sudo apt-get update
li@li:/mnt/c/Users/lizhi$ sudo apt-get update
[sudo] password for li:
Ign:1 http://mirrors.ustc.edu.cn/ubuntu precise-updates InRelease
Ign:2 http://mirrors.ustc.edu.cn/ubuntu precise InRelease
sudo apt-get upgrade
li@li:/mnt/c/Users/lizhi$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
sudo apt-get install samba samba-common
li@li:/mnt/c/Users/lizhi$ sudo apt-get install samba samba-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
二、配置samba服务器
1,修改共享目录权限
sudo chmod 777 /home/li
2,添加用户
sudo smbpasswd -a li
li@li:~$ sudo smbpasswd -a li
New SMB password:
Retype new SMB password:
3,配置sambe的配置文件
sudo vim /etc/samba/smb.conf
li@li:~$ sudo vim /etc/samba/smb.conf
在配置文件smb.conf的最后添加下面的内容
[li]
comment = share folder
browseable = yes
path = /home/hispark
public = yes
available = yes
guest ok = no
writable = yes
valid users = li
create mask = 0777
directory mask = 0777
4,重启samba 服务器
sudo service smbd restart
li@li:~$ sudo service smbd restart
* Stopping SMB/CIFS daemon smbd [ OK ]
* Starting SMB/CIFS daemon smbd
三、ubuntu与Windows进行文件共享配置
ifconfig查看Ubuntu的IP地址
li@li:~$ ifconfig
eth0: flags=4163
inet 172.28.126.45 netmask 255.255.240.0 broadcast 172.28.127.255
inet6 fe80::215:5dff:feb5:6f73 prefixlen 64 scopeid 0x20
ether 00:15:5d:b5:6f:73 txqueuelen 1000 (Ethernet)
RX packets 15969 bytes 23733705 (23.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6866 bytes 538077 (538.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 4 bytes 240 (240.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 240 (240.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
在Windows 按住 win+R组合键,输入IP地址 如 \xx.xx.xx.xx ,输入用户名和密码登录共享文件夹



