Ubuntu中安装nfs,tftp, samba服务的方法
apt-get install nfs-common nfs-kernel-server portmap
/nfs *(rw, sync,no_subtree_check,no_root_squash)
共享的目录IP,此处为*则为所有IP,也可写一个IP或IP段 如:
/nfs 192.168.1.*(rw,sync,no_subtree_check,no_root_squash)
重启服务:
查看nfs是否开启:/etc/init.d/nfs-kernel-server status
1、安装相关软件包
apt-get install tftpd tftp xinetd atftpd openbsd-inetd
2、建立配置文件
输入
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
保存退出。
3、建立tftp服务文件目录
mkdir /tftpboot
4、从新启动服务
/etc/init.d/xinetd restart
=======================================================
- 关闭linux防火墙:ufw disable
- 卸载samba-common: apt-get remove samba-common
- 安装samba: apt-get install samba
- 创建一个用于给windows访问的folder. 如: share
- 点击文件夹右键-> share folder:在share through中选择 Windows networks(smb) 然后取消 read only
- 增加samba user: sudo smbpasswd -a username(注:用户必须是系统用户)
- comment = 'Share for work'
- path= /mnt/shared
- guest ok = yes
- public = yes
- writable = yes
- create mask = 0777
- directory mask = 0777
- browseable = yes
- available = yes
同时,安全选项改为如下语句,否则在windows下登陆时需要验证:
gedit /etc/samba/smb.conf :
- # "security = user" is always a good idea. This will require a Unix account
- # in this server for every user accessing the server. See
- # /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
- # in the samba-doc package for details.
- security = share
#定义访问权限。访问权限由低到高有三种:share、user和server。其中share安全级别最低,user模式要求连接时输入用户名和口令. 还有其他很多选项。 自己喜欢吧。记得把你的共享项设置一下就行了。
这样,samba服务器就配置好了,下面进行验证:
我的PC windows IP地址是 192.168.1.108
Ubuntu的IP地址是:192.168.1.111
samba共享目录是:/mnt/shared
在Windows下点击开始运行,输入\\192.168.1.111\shared,可以进入共享目录
还可以将共享目录映射为一个硬盘:(挺方便的)
点击完成,这样就可以像访问windows下的一个盘一样访问debian下的共享目录了。
喜欢开源,乐意分享的大神们,欢迎加入QQ群:176507146,你值得拥有哦!
参考链接:http://www.cnblogs.com/zjfdbz/archive/2013/01/17/2865133.html
http://blog.sina.com.cn/s/blog_8bc300800101fn99.html
下载链接:http://www.kuaipan.cn/file/id_43409466388906194.htm