Ubuntu11.04与host主机共享文件夹问题解决
1.在终端中输入:sudo apt-get install open-vm-dkms
2.之后继续输入:sudo vim /etc/fstab
该文件列出了linux开机时自动挂载的文件系统的列表
3.在fstab中加入以下语句:
.host:/ /mnt/hgfs vmhgfs defaults,ttl=5 0 0
挂载的文件系统设备名/挂载点/挂载的文件系统类型/挂载选项/
4.在终端中输入:sudo reboot
重启后 press s键 to skip mount failure
5.在终端中输入: mount -a
6.进入/mnt/hgfs/目录,可以看到共享文件夹的名字,此时,可以通过共享文件夹与主机通信。
Tftp
1 客户端安装sudo apt-get install tftp tftpd
一般情况下,系统会根据依赖关系 openbsd-inetd ,还可能是xinetd,两者是不同的super-server。
2 根目录下创建tftpboot,属性修改为777.
3 设置TFTP服务器的根目录,开启服务。有些网页写的是修改/etc/xinetd.d/tftp
修改后的文件如下:
service tftp {
socket_type =dgram
protocol =udp
wait =yes
user =root
server =/usr/sbin/in.tftpd
server_args =-s /home/app -c
disable =no
per_source =11
cps =100 2
flags =IPv4
}
或者修改配置文件,结果应该是一样的,反正最终服务能起来。
sudo vi /etc/inetd.conf
tftp dgram udp wait root /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot
4
5 验证服务端口是否打开 # netstat –nlp
出现udp 0 0 0.0.0.0:69 0.0.0.0:* 4035/xinetd 即可
Nfs
1 客户端的安装
sudo apt-get install nfs-kernel-server nfs-common portmap
2 portmap配置
(1):sudo emacs /etc/default/portmap
去掉-i 127.0.0.1
(2)sudo dpkg-reconfigure portmap
运行后选择“否”
另外很重要的一点,要用sysv-rc-conf (而不是chkconfig)工具查看一下当前nfs 和portmap
的状态,若是off,则用sudo sysv-rc-conf portmap on 或sudo sysv-rc-conf nfs-kernel-server on
打开
3 配置挂载目录和权限
emacs /etc/exports
我的配置如下:
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync) hostname2(ro,sync)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt)
# /srv/nfs4/homes gss/krb5i(rw,sync)
#
/nfsboot *(rw,sync,no_root_squash)
解释一下:
#后面的都是解释
/nfsboot 是NFS 的共享目录,*表示任何IP 都可以共享这个目录,你可以改为受限的IP,rw
表示的是权限,sync 是默认的, no_root_squash表示允许挂接此目录的客户机享有该主机的root身份.
4 出现:mount.nfs: access denied by server while mounting 192.168.3.12:/home/lzgonline/rootfs时,查看出错日志文档,# cat /var/log/messages | grep mount,端口号大于1024,则要设置安全选项,修改配置文件/etc/exports,加入 insecure 选项
/home/lzgonline/rootfs *(insecure,rw,async,no_root_squash)
5 重启服务
sudo /etc/init.d/nfs-kernel-server restart