Linux and Linux Windows file sharing trivia

Source: Internet
Author: User
Tags scp command ssh secure file transfer ssh secure shell

Prerequisite Description:
Windows host information: 192.168.1.100 account: ABC password: 123 shared folder: Share
Linux host information: 192.168.1.200 account: def password: 456 shared folder:/home/def/share

Because the firewall and SELinux configuration are not yet in the meantime, some of the following methods are limited by their actions, so you should close both.
command to turn off the firewall: service iptables stop
Close selinux command: Setenforce 0

I. Implementing folder sharing between Linux and Windows
Directions: Windows Access Linux
Method 1: Use third-party software
1, modify the configuration file: Vi/etc/ssh/sshd_config, mainly to the port this parameter uncomment, other parameters can be modified according to the circumstances.
2. Restart the SSH service: service sshd restart
3, install the SSH secure SHELL under Windows, after successful installation there is a child program ssh secure File Transfer Client, open and enter:
HOSTNAME:192.168.1.200 (can be written as a Linux hostname if you have a DNS service)
PORT:22 (default value, can be modified to other values)
USERNAME:ABC (can also be another account under Linux)
Password:123
After the connection is successful, you can upload and download files to Linux under Windows.

Method 2:samba Sharing
1. Install Samba: You can first check if the installation is installed: RPM-QA | grep samba, without the words to install it yourself, here is an on-line installation mode based on RPM package Yum
Yum is a quick-install mode that automatically solves the dependencies of software installation and automatically downloads the appropriate software for installation on a specific server, with simple commands: Yum installs Samba, which is fast and easy behind the programmer's hard work!
2, create the shared folder, this is Mkdir-m 777/home/def/share
3, modify the/etc/samba/smb.conf, the parameters in this is more, mainly
Workgroup = Workgroup (this is the Windows Workgroup mode, and there is a domain mode)
Hosts allow = 192.168.1.100 (can put the IP address to ask, when the Windows address is written here)
Then at the end of the file, add
[Public] (share name, which is the name that will be displayed when Windows is accessed)
Comment = Public Stuff (note)
Path =/home/def/share (share name)
Public = yes (open)
writable = yes (writable)
Of course, here are just some of the basic parameters, as well as other parameters according to the situation settings, such as garbled, and also specify the encoding format.
4. Restart the SMB Service: Service SMB restart
5. Create a Samba customer: Smbpasswd-a def, enter the password after entering. This is the future remote host login required password, where the DEF account must be the system already
Account number, no words will error, and then the new password is a remote login password, the advantage of doing so is their password and remote login separate.
6, Windows connection, start running, enter \\192.168.1.200, enter the SMB account password can be


Directions: Linux Access windows
Method One: Mount the shared folder
Execute Mount-o username=abc//192.168.1.100/share/mnt/share under Linux, enter password after carriage return, is Windows password 123
To be honest, this approach is well understood, and the simplest syntax is to mount commands. But it is the most confusing, because the partition format under Linux is Ext2\3\4, and Windows generally uses NTFS format, which is not recognized by Linux, and it can be mounted, and it can read the files. It's unbelievable.

Third, realize the folder sharing between Linux
Method One: Mount
1. Create a shared folder on a machine: Mkdir-m 777/home/share
2, modify the/etc/exports file, add a/home/share * (rw), this/home/share specify the share location, * on behalf of all the host, you can also write the IP address, RW is read-write
3. Restart NFS Services: Service NFS Restart
4, on the B machine mount: mount-t NFS 192.168.1.100:/home/share/mnt/share, enter the account password can be
5, the last is on the B machine to verify whether the Mount succeeds, command: DF
Method Two: Use the SCP command to transfer
This command is what I just learned yesterday, very simple operation Scp/home/share (source) 192.168.1.200:/home/share (Purpose), enter the password after entering, specifically see man SCP

Linux and Linux Windows file sharing trivia

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.