Author: cjh
Theme: samba install andconfiguration
在介绍如何安装配置samba之前,先简单介绍linux中两个命令的区别分别是update和upgrade。
update
update是同步 /etc/apt/sources.list 和/etc/apt/sources.list.d 中列出的源的索引,这样才能获取到最新的软件包。
upgrade
upgrade 是升级已安装的所有软件包,升级之后的版本就是本地索引里的,因此,在执行 upgrade 之前一定要执行 update, 这样才能是最新的。
1. sudo apt-get install samba samba-common
要是出现错误则先执行apt-get update
2. 在home目录下创建共享目录
mkdir /home/your share file name
sodu chmod 777 /home/your share file name
3. 修改配置文件
先保存现有的配置文件
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
修改先配置文件
sudo gedit /etc/samba/smb.conf
最后在smb.conf后面添加
[share]
path = /home/ your share file name
available = yes
browseable = yes
public = yes
writable = yes
4. 创建samba账户
sudo touch /etc/samba/smbpasswd
sudo smbpasswd -a username
然后输入你的账户和密码
5. 重启samba服务器
sudo /etc/init.d/samba restart
测试首先在windows下打开cmd。下图中192.168.253.3为你ubuntu的ip地址,根据你自己机器的实际情况进行更换,可在终端中输入ifconfig查看你的ip地址。
通信成功后,再win+R中输入\\192.168.253.3便会跳出你的共享目录
Add in 2016.12.26
如果出现在添加用户时出现Failed to add entry for user,建议用户名改为当前用户名字,可避免错误