- How to share files between a Linux and Windows computer
- Create a shared folder on Windows
- Access a Windows shared folder from Linux, using Konqueror
- Access a Windows shared folder from Linux, using Nautilus
- Access a Windows shared folder from Linux, using the command line
- Getting Shared Folders working properly in Debian 9 in VirtualBox
- Debian shared folder with windows
- Установка CIFS
- Монтируем Windows Share (сетевой ресурс)
- Безопасность учетных данных при монтировании через CIFS
- Как сделать автоматическое монтирование общей папки Windows
- Как размонтировать общую папку CIFS
- Автор
- Возможно Вам будет это инетересно
- Как инвертировать совпадение по grep
- Как посмотреть список пользователей Linux
- Конфигурация файла .gitignore в Git
- 7 thoughts on “Как подключить общую папку (сетевой ресурс, шару) Windows к Linux”
- Shared folder in QEMU between Windows Host and Debian Guest
- 1 Answer 1
- How to Access Windows Shared Folder from Linux?
- Share File Between Windows and Linux
- Install Samba Linux File Sharing Service
- Access Windows Shared Folder from Linux
How to share files between a Linux and Windows computer
The easiest and most reliable way to share files between a Linux and Windows computer on the same local area network is to use the Samba file sharing protocol. All modern versions of Windows come with Samba installed, and Samba is installed by default on most distributions of Linux.
Create a shared folder on Windows
First, create a shared folder on your Windows machine.
- Open the Control Panel.
- Go to Network and Sharing Options.
- Go to Change Advanced Sharing Settings.
- Select Turn on Network Discovery and Turn on File and Print Sharing.
Now, create a new folder to share or choose an existing folder that you’d like to share.
- Right-click the folder and select Properties.
- Go to the Sharing tab.
- Above the Share button is the network name of the share you are creating. It should look like \\YOURCOMPUTERNAME\Users\YourUserName\ShareFolderName. Make a note of this network name to use later on your Linux machine.
- Click Share.
Access a Windows shared folder from Linux, using Konqueror
Many Linux distributions use the KDE desktop environment and the Konqueror file manager/browser. If this is what you are using, you can follow these steps to access your Windows shared folder:
- Click the K menu icon.
- Select Internet ->Konqueror.
- In the Konqueror window that opens, click the Network Folders link, or type remote:/ in the address bar and press Enter .
- Click the Samba Shares icon.
- Click the icon of your Windows Home workgroup.
- Click the Workgroup icon.
- Click the icon for your computer.
- When prompted, enter the username and password for the Windows account that created the share.
- Click OK.
Access a Windows shared folder from Linux, using Nautilus
Many Linux distributions, especially those that use the GNOME desktop environment, use the Nautilus file manager. If this is what you’re using, you can follow these steps to access your Windows shared folder:
- Open Nautilus.
- From the File menu, select Connect to Server.
- In the Service type drop-down box, select Windows share.
- In the Server field, enter the name of your computer.
- Click Connect.
Alternatively, in the Nautilus address bar, you can type smb://ComputerName/ShareName and press Enter . For instance, when you created your Windows Share, if the share name was listed as:
Type smb://YOURCOMPUTERNAME/Users/YourUserName/ShareFolderName and press Enter . Note the smb: at the beginning; in Linux, use forward slashes instead of backslashes.
Access a Windows shared folder from Linux, using the command line
You can also access your Windows share from the Linux command line using the smbclient program.
- Open a terminal.
- Type smbclient at the command prompt.
- If you receive a «Usage:» message, this means smbclient is installed, and you can skip to the next step. If the command is not found, however, you need to install smbclient. Follow these steps to install it.
Getting Shared Folders working properly in Debian 9 in VirtualBox
Running Debian 9 in VirtualBox is easy but figuring out how to get Shared Folders working properly can be a hassle. Here’s how to do it.
Assumptions:
– You have a VirtualBox VM set up with Debian 9.3 and nothing more.
– The user who’s running the X sessions is called Vorkbaard.
– The Windows folder you’re sharing is called D:\vbox.
– The Linux mount point is /home/vorkbaard/host.
– The session user has sudo rights.
Click any image to open a larger version.
First order of business is installing the Guest Additions (source):
In the gui click Devices, select Insert Guest Additions CD Image.
As the session user:
Restart the VM and resize its window to verify the Guest Additions were installed correctly. The Desktop Environment should be scaled along with the VM window. If it doesn’t, kick it until it does.
From the Devices menu select Shared Folders > Shared Folders Settings.
Select Machine Folders and click the + icon. Select your host’s folder path and enter a folder name to be used in the guest. Make things easy and don’t use spaces or weird characters.
Also note that you should not use the same name for your host folder and mountpoint.
Transient folders will exist only for the duration of this VM session. Machines folders will remain.
While you’re at it, enable bidirectional sharing of the clipboard and Drag and Drop. This had nothing to do with folder sharing, it is a matter of preference.
Reboot your VM or reset your X session for the new settings to take, then test if you can mount your share. First make a directory host to function as your mountpoint:
Mount the share:
Test if you can read and write in the folder. If you can’t write here the problem is most likely that you chose a host folder in the wrong location (C:\ or %userprofile%). Try a location at C:\Somefolder\ or D:\vbox.
You should not need options like rw,uid=1000,gid=1000, and so on in your mount command.
Now this is all good and well but we want to mount the share automatically upon boot so we should enter the mount in /etc/fstab.
Unmount the share with
Note that umount is not spelled uNmount.
Add your user to the vboxsf group, otherwise you will not be able to actually use the share:
Open /etc/fstab and add:
Again, you should not need gid and uid definitions here.
Mount all shares defined in fstab:
Test to see if it works:
If it doesn’t work, scream at it until it does. Note that Gedit will not write to files at the share, apparently this is a problem between Gedit and VirtualBox. Other editors have no problem with it.
Reboot, verify that it is still working and rejoice \o/
Debian shared folder with windows
CIFS (Common Internet File System) — это популярный протокол обмена файлами в Интернете. Этот протокол и позволит пользователям ОС Linux получить доступ к общей папке Windows.
CIFS — это реализация SMB (Server Message Block) — протокола, используемого для совместного использования сетевых файлов. Но он устарел.
В этой статье мы по шагам пройдем все этапы установки и настройки CIFS, чтобы подключиться к сетевому ресурсу Windows на ОС Linux.
Установка CIFS
Сейчас мы установим пакет cifs-utils на Ubuntu Linux (точно так же можно сделать на всех Debain-подобных ОС).
Монтируем Windows Share (сетевой ресурс)
Сейчас мы разберем на примерах, как монтировать общую папку Windows вручную и автоматически.
Создадим на нашем Linux директорию, к которой мы будем монтировать сетевой ресурс. Назовем ее myshare и расположена она будет в каталоге /mnt
Сетевой ресурс (шара) Windows может быть примонтирован к ОС Ubuntu или Debian с помощью следующей команды:
WIN_HOST_IP — это IP адрес хоста Windows, на котором расположена общая папка
share — имя сетевого ресурса
user — наш пользователь и Passw0rd — пароль с которыми мы подключемся к шаре.
Если пользователь доменный, то необходимо в опциях (-o) указать домен.
По-умолчанию сетевой ресурс монтируется с полными правами (rwx или 777). Если Вы хотите установить иные права, используйте опции dir_mode и file_mode.
Так же Вы можете установить владельцев uid (id пользователя) и gid (id группы).
Если после выполнения предыдущих команд Вы не получили никаких ошибок, то можете с помощью команды df -h убедиться, что сетевой ресурс успешно примонтирован к нашему ПК на Linux. В примере WIN_HOST_IP = 192.168.1.100 и имя общей папки share
Безопасность учетных данных при монтировании через CIFS
В этом разделе опишем, как лучше всего передавать учетные данные (имя пользователя, пароль, домен) при монтировании сетевого ресурса к ОС на базе Линукс.
Создайте файл с учетными данными для cifs: /etc/cifs-credentials
Внутрь поместите следующее содержимое:
Задайте права для этого файла:
Теперь мы можем подключить общую папку такой командой:
Как сделать автоматическое монтирование общей папки Windows
В примерах выше, после того, как Вы перезагрузите свой ПК, сетевой ресурс не примонтируется. Поэтому сделаем так, чтобы шара подключалась автоматически. В Linux это делается через файл /etc/fstab. Откройте этот файл любимым редактором.
И добавьте такую строку:
Следующей командой запустим монтирование всех точек, описанных в /etc/fstab
Теперь наш удаленный сетевой ресурс будет доступен даже после перезагрузки.
Как размонтировать общую папку CIFS
Размонтирование производится таким же способом, как и обычно мы жто делаем с дисками:
Часто бывает так, что сетевой ресурс занят каким-то процессом и тогда Вы получите ошибку при попытке размонтирования, тогда запустите команду с ключем -l (—lazy)
Итак, в этой статье мы рассмотрели, как быстро примонтировать удаленную сетевую папку, которая находится на хосте с Windows, к нашему хосту на Linux с помощью CIFS. Если у Вас остались какие-либо вопросы, пожалуйста, пишите в комментариях.
Автор
Админ
Возможно Вам будет это инетересно
Как инвертировать совпадение по grep
Как посмотреть список пользователей Linux
Конфигурация файла .gitignore в Git
7 thoughts on “Как подключить общую папку (сетевой ресурс, шару) Windows к Linux”
[ 13.068117] CIFS: Attempting to mount //192.168.10.250/home
[ 13.068332] CIFS VFS: Error connecting to socket. Aborting operation.
[ 13.068339] CIFS VFS: cifs_mount failed w/return code = -2
[ 13.068431] CIFS: Attempting to mount //192.168.10.250/home/Drive/школа/English
[ 13.068556] CIFS VFS: Error connecting to socket. Aborting operation.
[ 13.068564] CIFS VFS: cifs_mount failed w/return code = -2
[ 13.069981] CIFS: Attempting to mount //192.168.10.250/Учебный_год_3В
[ 13.070234] CIFS VFS: Error connecting to socket. Aborting operation.
[ 13.070241] CIFS VFS: cifs_mount failed w/return code = -2
[ 15.184815] usb 1-1: reset high-speed USB device number 2 using ehci-pci
[ 17.861600] random: crng init done
[ 17.861607] random: 7 urandom warning(s) missed due to ratelimiting
[ 23.589870] tg3 0000:3f:00.0 enp63s0: Link is up at 100 Mbps, full duplex
[ 23.589872] tg3 0000:3f:00.0 enp63s0: Flow control is off for TX and off for RX
[ 23.589901] IPv6: ADDRCONF(NETDEV_CHANGE): enp63s0: link becomes ready
Все бы хорошо, но не успевает сетевуха поднять линк
дальше вручную «sudo mount -a» и все взлетает
[ 697.728246] CIFS: Attempting to mount //192.168.10.250/home
[ 700.739946] CIFS: Attempting to mount //192.168.10.250/Учебный_год_3В
[ 701.090973] CIFS: Attempting to mount //192.168.10.250/home/Drive/школа/English
вот вопрос, как бы заставить монтироваться после поднятия линка и получение адреса
ноут по wifi нормально отрабатывает, а системник с обычной сетевухой нет
Shared folder in QEMU between Windows Host and Debian Guest
How do you share between the two? I have booted my image on my Windows 10 host using this: qemu-system-x86_64 -hda debian.img -m 512 -net user,smb=C:\users\jason\Desktop\sharing\ -net nic,model=virtio
In the guest I tried to connect to Samba through this:
I also tried smbclient //10.0.2.15/qemu which returned
The /tmp and /mnt directories remain empty.
1 Answer 1
I just dealt with this problem, so I’d like to put the answer here, as the documentation does not make it obvious.
As you may know, Windows supports setting up SMB shares natively through Explorer (the «Sharing» option in the right-click menu for a directory). This link, found in a GitHub Gist collection, suggests that the proper way to share from Windows host to a guest is to access the host computer directly, using the address 10.0.2.2, rather than using the qemu SMB share, which doesn’t seem to start properly on a Windows host.
So, The solution is —
Share the directory you want to be shared as if you were setting it up to be shared with a physical machine.
Use the address 10.0.2.2 from your guest, specifying the name of the share rather than «qemu.»
I just tested this from a Windows 10 host to a Windows PE guest, and it worked like a charm. Obviously, you’d have to set up the share permissions correctly, but this is pretty simple from the sharing dialog.
How to Access Windows Shared Folder from Linux?
Sharing files between two operating system is easy, but between the different operating systems such as Linux, Windows and Mac OS is a bit confusing. Windows has its files sharing protocol (SMB), and Linux has itself (Samba). Here we help you to learn how to access Windows shared folder from Linux. This file sharing article guide you to connect Windows and Linux system at home or office network.
Previously, we wrote many articles related to network file sharing between the operating system and make them connect with each other. The below network file sharing articles are beneficial to read.
Yes, we already have many informative articles that help you make your network easy with different operating systems. Just follow the step by step file sharing guide between Windows and Linux.
Share File Between Windows and Linux
Before access Windows shared folder from Linux, once check the Windows 10 network discovery is enabled, the shared folder must share correctly with share and NTFS permission. See the screenshot of sharing a folder in Windows 10.
How to Share a Folder in Windows 10 – Technig
- Create a folder and right-click the folder then click Properties.
- On the Properties, select Sharing tab then clicks Advanced Sharing.
- Select Share this folder on the Advanced sharing page then click Permission.
- Now, tick the check box of Change on Permission window and click OK to apply the changes.
For more details about sharing files in Windows 10 read this article: “Sharing files between Linux and Windows 10“. You can find enabling network discovery and file sharing by details.
Install Samba Linux File Sharing Service
Now, let’s access Windows shared folder from Linux Ubuntu. Before accessing the shared folder from Linux, you must have installed the Sharing Services on your Linux system. If you didn’t, the system would ask you to install sharing services when you attempt to share a folder on Linux.
Install file sharing service in Linux Ubuntu – Technig
On the Linux Ubuntu prompt that the sharing service has not installed. You need to install the Windows networks sharing service to share your folders. So click Install service and continue to finalize the sharing services installation.
This is because the Samba Linux file sharing system has not installed on your Linux system.
The Samba is a free software re-implementation of the SMB/CIFS networking protocol. Samba provides file and print services for various Windows clients and can integrate with a Windows Server domain, either as a Domain Controller (DC) or as a domain member. So in this article, we are using in Per-to-Per network between Windows clients and Linux Ubuntu clients. If you don’t like reading then watch the video tutorials at the end of this post.
Finally, start Sabma Linux file sharing service with “sudo start smbd” command and follow the next step to access Windows shared folder from Linux.
Access Windows Shared Folder from Linux
You should be able to mount the shared folder by using the GUI in Linux, but it’s also very easy to do with the command line. We’re going to use the terminal for accessing shared files quicker.
First, you’ll need the cifs-utils package to mount SMB shares. Just type the “sudo apt-get install cifs-utils” command at the terminal to install cifs-utils package.
How to access Windows shared folder from Linux command line – Technig
After installing cifs-utils package, try to create a folder and mount the Windows SMB share folder with. To create a folder type “mkdir
To mount the Windows shared folder type “sudo mount.cifs //Technig-Win10/SharedFiles /home/ulx/Desktop/WinFiles/ -o user=Win10” command.
Access Windows Shared Folder from Linux
If you need help to understand the mount command, just check the below commands descriptions.
- sudo mount.cifs: This is just the mount command, set to mount a CIFS (SMB) share.
- Technig-Win10: Is the name of the Windows computer. Type “hostname” on CMD to find your Windows computer name.
- //Technig-Win10/SharedFiles: Is the full path to the Windows shared folder.
- /home/ulx/Desktop/WinFiles: Is where we’d like the share files to be mounted on the Linux system.
- -o user=Win10: Is the Windows username that we are using to access the shared folder. Type “net user” in CMD to find the user name of Windows.
Now, open the WinFiles to see the shared files inside. These are the shared files from Windows 10.
How to Share Files Between Windows and Linux – Technig
That’s good; this is the simple and quick guide to access share files between Linux and Windows. Hope you enjoy this article related to access Windows shared folders from Linux.