Three ways to share files between Linux and Windows __linux

Source: Internet
Author: User

Author: huaqing visionary lecturer

The first kind of samba sharing

1, install Samba: You can first check whether it has been installed: RPM-QA | grep samba, without the words installed under it, here is an online installation mode based on RPM package Yum Yum is a fast installation mode, it will automatically solve the software installation problem and automatically download the appropriate software for installation, installation command: Yum install Samba

2. Create a shared folder Mkdir-m 777/home/default/share

3, modify the/etc/samba/smb.conf, this inside the parameters are more, mainly

Workgroup = Workgroup (this is the Windows Workgroup mode and one is the domain mode)

Hosts allow = 192.168.1.100 (you can put the IP address to ask, the Windows address when written here)

And then at the end of the file, add

[Public] (share name, which is the name that will appear when Windows accesses)

Comment = Public Stuff (note)

Path =/home/def/share (share name)

Public = yes (open)

writable = yes (writable)

Note: vim/etc/samba/smb.conf. Will Security=share. I win7 the system.

Of course, here are just some basic parameters, there are other parameters according to the situation settings, such as garbled, but also to specify the encoding format.

4. Restart SMB Services

Service SMB Restart

5. Create Samba Customer

Smbpasswd-a Def, you will be prompted for a password when you enter. This is the future remote host login required password, here the DEF account must be the system already has an account number, no words will be the error, and then the new password is remote login password, the advantage is that their password and remote login password separate.

6, Windows connection, start running, input \\192.168.1.101, enter the SMB account password can be

The second way to access host-side shared folders via NFS

Introduction to NFS: NFS, is the shorthand for network file system, the network filesystem. The network file system is one of the FreeBSD supported file systems, also known as NFS. NFS allows a system to share directories and files with others on the network. By using NFS, users and programs can access files on the remote system as they would access local files.

The most obvious benefits of NFS:

1> local workstations use less disk space because the usual data can be stored on a single machine and can be accessed over the network.

2> users do not have to have a home directory in the machine on each network. The home directory can be placed on an NFS server and available everywhere on the network.

3> such as floppy drive, CDROM, and Zip (refers to a high storage density of disk drives and disks) can be used by other machines on the network. This reduces the number of removable media devices on the entire network.

1. Install NFS Server

Sudo Apt-get Install Nfs-kernel-server

2. Configure Server for NFS

Sudo Vi/etc/exports

/source/rootfs * (Rw,sync,no_subtree_check,no_root_squash)

Rw: With read and write access

Sync: File synchronization writes to memory and hard drive

No_subtree_check: If the root directory is shared, subdirectories are not checked

No_root_squash: If the client is root, then he has root permissions on the directory

3. Reboot Server for NFS

Sudo Service Nfs-kernel-server Restart

4. Carry on the test of Mount

Sudo mount-t NFS Localhost:/source/rootfs/mnt

Ls-l/mnt

5. Uninstall

Sudo umount/mnt

The third way to access host-side shared folders via 9p-virtio

9p-virtio Introduction: English is all called: Plan 9 folder sharing over VIRTIO-I/O virtualization framework, is a host and guest-side shared folder file system services. Currently, the guest side does not support the WinDOS system (the system does not support the Virtio service, and the Mount command does not support mounting the file system in that format). I tested the guest end with a ubuntu-13.10.

1, check whether the host side supports 9p-virtio.

Lsmod | grep 9p

If 9p.ko,9pnet_virtio.ko,9pnet.ko is already loaded, the virtio-9p is already supported.

If not, the kernel or 9p corresponding module needs to be recompiled and loaded into the host system. The following configuration options need to be added to the kernel before compiling:

Config_net_9p=y

Config_net_9p_virtio=y

Config_9p_fs=y

Config_9p_fs_posix_acl=y

Note: If it is a module, change y to M, it is recommended to compile the driver module, save time, ' High security '.

2, the client installs the Linux system, I install the ubuntu13-10 version.

You need to use the root account for the test, so activate the root account password first,

Ubuntu default root password does not start, password activation: sudo passwd root input you

The user's password when installing the system, setting the root password.

Turn guest off and start guest with host-side command.

The 3,host-side boot virtual machine command parameters are as follows:

QEMU-KVM–CPU host-m 1024-ENABLE-KVM

-drive File=/var/lib/libvirt/images/zxc_linux1.img,cache=writeback,if=virtio-localtime

-fsdev Local,id=test_dev,path=/var/share,security_model=none

-device Virtio-9p-pci,fsdev=test_dev,mount_tag=testmount

-vnc 0.0.0.0:0-VGA cirrus-monitor stdio

The parameters that enable 9p are interpreted as follows:

-fsdev Fsdriver,id=[id],path=[pathtoshare]

, Security_model=[mapped|passthrough|none][,writeout=writeout]

[, ReadOnly] [, SOCKET=SOCKET|SOCK_FD=SOCK_FD]

-device Virtio-9p-pci,fsdev=[id],mount_tag=[mount Tag]

Fsdriver: This option specifies the FS driver to use, currently supports "only", "Handle", "proxy" file system driver.

Id: Used to associate Fsdev

The folder to be shared by the path:host end.

Security_model: Should be shared permissions, the official explanation is: Valid options are mapped, one is the pass mode, one is none. You do not need to specify this option when the proxy file system is driven.

-DEVICE Specifies the device VIRTIO-9P-PCI.

Mount-tag: An identifier that is used to mount the guest end of the tag.

4, create a folder on the host side to share with the guest side

Mkdir/var/share

5, execute the following command on the client:

Mount-t 9p-o trans=virtio testmount/tmp/shared/-oversion=9p2000. L,posixacl,cache=loose

-T identifies mount type;

-O identifies shared transmission mode;

Testmount is Mount_tag;

/tmp/shared is the directory that the guest side will mount to the host-side shared folder.

The

-oversion is the version information that identifies 9p.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.