Ubuntu shared folder to windows

Source: Internet
Author: User


I. Install smb

Execute the command line:

# Sudo apt-get install samba

# Sudo apt-get install smbfs



2. Add the shared folder.

You can use either of the following three methods to configure Shared Folders:

1. Use the graphical interface sharing Function in ubuntu

Press Alt + F2 or open the terminal to open the execution program interface. Run the following command:


Note: This tool integrates SABMA and NFS to manage shared directory resources.



2. Use a graphical interface to manage the SAMBA Service (system-config-samba)

You can also use a simple graphical management interface to manage some common functions. You can run the following command on the terminal to install the graphical management program.

After sudo apt-get install system-config-samba is installed, you can use the system> system Management> samba to start the samba management function of the graphic interface.



3. Use the tool nautilus-share)

You do not need to modify any settings. Anyone can use this tool to quickly and easily share the file volumes in their directories. It has been installed by default in ubuntu9.10, if the tool has not been installed, run the following command on the terminal to install it.

Sudo apt-get install nautilus-share

Use this method to go to your own directory. You can right-click the folder to be shared, select "Share Option", and select "share this directory" in the pop-up window ".



If the execution of the sub-process "testparm" fails (there is no such file or directory), you can execute the following installation command.

Sudo apt-get install samba-common-bin



Iii. Anonymous Access to Ubuntu shared files in windows

When samba is used without any settings, the winXP machine can connect to the Ubuntu machine but prompts you to enter the username and password. At this time, no matter what you enter, you cannot access it. To achieve anonymous access, you need to make the following settings:

1) modify the configuration file smb. conf:

Sudo nano/etc/samba/smb. conf

Search for "security = user" and change it to "security = share". Then, remove the annotator "#" in front of this line.

2) Restart samba:

# Sudo/etc/init. d/samba restart



In this way, the folder can be accessed anonymously in Windows, but it is read-only and cannot be written. This is true even if the read-only attribute is removed from the Ubuntu GUI.

You can perform read/write operations and change the folder permissions. The command is as follows:

Chmod 777/home/temp (the folder path and name here)



4. Use the user name and password in Windows to access the shared files in Ubuntu

Next, let's share the readable and writable folders of the group. Assume that the folder you want to share is/home/ray/share. First, create this folder.


# Mkdir/home/ray/share

# Chmod 777/home/ray/share

Back up and edit smb. conf to allow network users to access


Sudo cp/etc/samba/smb. conf/etc/samba/smb. conf_backup

Sudo gedit/etc/samba/smb. conf

Search for this line of text


; Security = user

Replace the following rows


Security = user

Username map =/etc/samba/smbusers

Add the following lines of code to the end of the file: newsfan. The shared folder name is Share.



Comment = Shared Folder with username and password

Path =/home/ray/share

Public = yes

Writable = yes

Valid users = newsfan

Create mask = 0700

Directory mask = 0700

Force user = nobody

Force group = nogroup

Available = yes

Browseable = yes

Change the value here by the way. Find [global] and change workgroup = MSHOME


Workgroup = WORKGROUP

Displays charset = UTF-8

Unix charset = UTF-8

Dos charset = cp936

The following three lines are used to prevent Chinese directory garbled characters. Depending on your local, the UTF-8 may need to be changed to cp936. Do it yourself. Now you need to add the newsfan network access account. If this account does not exist in the system


Sudo useradd newsfan

Note that the newsfan user is added, but the logon password of the local machine is not granted to the user. Therefore, this user can only be remotely accessed and cannot log on from the local machine. In addition, the samba logon password can be different from the local logon password. Now you want to add a network user account:


# Sudo smbpasswd-a newsfan

# Sudo gedit/etc/samba/smbusers

Add the following line to the new file and save it.


Newsfan = "network username"

Use this command to change the newsfan network access password in the future.


# Sudo smbpasswd-a newsfan

Run the command to delete the account of a network user and change-a to-x.


# Sudo testparm

# Sudo/etc/init. d/samba restart

From: eric_zhang's blog

Related Article

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.