Samba-based file sharing in Windows Linux (no permission Control)

Source: Internet
Author: User
Samba-based file sharing in Windows Linux
  • Operation in Windows

1. Set the shared directory, such as: D: // share
2. Create a working group windowslinux on "Network neighbors". The created working group will automatically share the "share" directory;
3. Create a new user "Linux" for Linux to operate shared files and set the corresponding permissions;
4. Add the "Linux" user access permission to the "share" directory;

  • Operations in Linux

1. Start the samba Service
[Root @ localhost ~] #/Etc/init. d/SMB start
Start the smb service: [OK]
Start nmb service: [OK]

Run the following command to check whether the server is running;
[Root @ localhost ~] # Pgrep smbd
[Root @ localhost ~] # Pgrep nmbd

View the SMB port number
[Root @ localhost ~] # Netstat-tlnp | grep SMB
TCP 0 0 0.0.0.0: 139 0.0.0.0: * Listen 10639/smbd
TCP 0 0 0.0.0.0: 445 0.0.0.0: * Listen 10639/smbd

If you have a firewall, you must open these two ports. Or clear firewall rules;
[Root @ localhost ~] # Iptables-f or
[Root @ localhost ~] #/Sbin/iptables-F

2. Modify the/etc/samba. conf file to implement an anonymous readable and writable
[Root @ localhost ~] # Cd/etc/samba
[Root @ localhost Samba] # mv smb. conf SMB. confbak

Write the following paragraph into smb. conf;

[Global]
Workgroup = windowslinux;
NetBIOS name = zhaoxr
Server String = Linux Samba server testserver
Security = Share

[Linuxsir]
Path =/share
Writeable = Yes
Browseable = Yes
Guest OK = Yes

[Global] This section is a global configuration and is required. There are the following rows;
Workgroup is the working group displayed in windows. Here I set windows Linux; (in upper case );
NetBIOS name is the name of the computer displayed in windows;
Server String is the description of the Samba server, which can be defined by yourself. This is not important;
Security is the authentication and login method. Here we use share. There are many authentication methods, one of which is also commonly used as the user authentication method. If share is used, you do not need to set the user and password;

[Linuxsir] the shared directory is displayed in windows;
Path = You can set where the directory to be shared is stored;
Whether writeable can be written. Here I set it to writable;
Whether browseable can be viewed or not. If browsed, we can see shared folders under the Working Group. If you do not want to display it, set it to browseable = No.
Guest OK anonymous users log on as guest;

3. Create a directory and authorize it;

[Root @ localhost ~] # Mkdir-P/share
[Root @ localhost ~] # ID nobody
Uid = 99 (nobody) gid = 99 (nobody) groups = 99 (nobody)

[Root @ localhost ~] # Chown-r nobody: Nobody/opt/linuxsir

  • View shared files

1. View Linux sharing in Windows
After the Linux SAMBA service is started, enter "// ip address" in the browser to view the shared folder.
2. View windows sharing in Linux
A. Log in
Smbclient-l // ip-u Linux
B. Mount
Mount-T smbfs-O username = Linux, password =... // ip/share/mnt/windowsshare
You can see the content in/mnt/windowsshare.

 

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.