1.确保ubuntu12.04能上网。参考http://blog.csdn.net/hexiechina2010/article/details/50451909
2.apt-get upgrade 更新源
(1)如果出现
- Err http://archive.canonical.com natty InRelease
- Err http://security.ubuntu.com oneiric-security InRelease
- Err http://extras.ubuntu.com natty InRelease
- Err http://security.ubuntu.com oneiric-security Release.gpg
- Temporary failure resolving ‘security.ubuntu.com’
(2)如果还是不成功,检查一下源表
Ubuntu 12.04源列表 sudo vim /etc/apt/sources.list 是否正确,以前我把源表设置成本地文件夹了。
然后apt-get update
安装步骤
1、使用下列命令安装samba
sudo apt-get install samba
sudo apt-get install smbfs
sudo apt-get install smbfs
如果出现类似“目前安装samba所依赖的程序版本与目前已安装的版本符合”
openssh-server: Depends: openssh-client (= 1:5.3p1-3ubuntu3(版本旧)) but 1:5.3p1-3ubuntu5(版本新) is to be installed
E: Broken packages 此语句是网络找的,不是按照samba的,但意思一样,原来的找不到了,请见谅
这句话的意思是依赖旧的版本1:5.3p1-3ubuntu3,但目前1:5.3p1-3ubuntu5(版本新)已经安装。则需要降低版本
sudo apt-get install openssh-client= 1:5.3p1-3ubuntu3即可。
2、创建一个文件夹
mkdir ~/UbuntuSharesudo chmod 777 ~/UbuntuShare
sudo useradd ShareUseName
①备份一下配置文件
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
②用vim编辑配置文件
sudo vim /etc/samba/smb.conf
③添加配置信息
[Share] 网上找的。
path = ~/UbuntuShare
available = yes
browseable = yes
public = yes
writable = yes
valid users = ShareUseName
create mask = 0700
directory mask =0700
force user =nobody
force group = nogroup
#======================= Share Definitions =======================
243
244 # Un-comment the following (and tweak the other settings below to suit)
245 # to enable the default home directory shares. This will share eac h
246 # user's home director as \\server\username
247 [homes] 将此行的注释去掉,因为我的共享文件在家目录里,没有此行登陆不进去
248 comment = Home Directories
249 browseable = yes
sudo touch /etc/samba/smbpasswd
sudo smbpasswd -a ShareUseName
sudo smbpasswd -a book (用户名可以是系统用户名,book是我的系统的用户)
然后按照提示输入密码(假如:abc123)就好了。
6、重启samba服务器
sudo /etc/init.d/smbd restart7.此种配置方法,亲测后,只能登陆book
book@ubuntu:/home$ sudo smbclient //192.168.137.208/book -U book
Enter book's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.3]
smb: \>
book@ubuntu:/home$ sudo smbclient //192.168.137.208/UbuntuShare -U book 不知道咋弄,反正能用家目录用了,先不弄了,工作要紧啊
Enter book's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.3]
tree connect failed: NT_STATUS_BAD_NETWORK_NAME
常见错误
如tree connect failed: NT_STATUS_LOGON_FAILURE
网络搜索《Samba服务学习报错总结》
防止出现中文目录乱码的情况,请在、/etc/samba/smb.conf 中加入下面三行
[global]
display charset = UTF-8
unix charset = UTF-8
dos charset = cp936
这个是介绍samba与windowns通信原理方面的文章。http://blog.csdn.net/deansrk/article/details/6696193
这里贴一个安装和配置samba的文件 http://www.lupaworld.com/thread-872462-1-1.html
http://blog.chinaunix.net/uid-26748719-id-3782289.html