Linux make folder shared

Share a Folder between two Local Users

I and my brother have User Accounts on this machine. I want to share the Documents directory with him. Is there a STRAIGHTFORWARD way to do it? I am not a power user so I am looking for a way to do this using nautilus, rather than a script or a way that requires creating symlinks. I can download an application if i have to. Last time I wanted to do this I just copied the contents to /home for both of us to use. Something I can do in System Settings would be appreciated

Once you created the shared directory with the right permission, you can just access by smb://127.0.0.1

Is «Documents Director» the name of the folder or is Director the name of the folder that resides in your Documents folder? Why no symlink creation? It can be done by drag and drop.

maybe i put the question in a wrong way.. but i want an easy way out.. methods already available give out scripts to achieve this.

@Achu i tried you method.. i get an error saying «unable to mount location, failed to mount windows share». am i missing something really obvious?

3 Answers 3

There are three steps to this process

Step One: Make your brother a member of your group.

Your group-name is same as your user-id. Say, if your user-ID is akumar your group name is also akumar . If your brother’s ID is bkumar , then you want to make bkumar a member of the group akumar . See How to manage users and groups? for how to add your brother’s user-ID to your group.

Step Two: Change the permission of the folder you want to share.

Open Nautilus. Right click on the folder you want to share. Go to permissions tab. look for the group permissions and change it into «Read and Write.» Check the box for allowing the same permissions to the files and folders inside.

Step Three: Verify that your brother can create delete files in the shared folder.

Let your brother login to the computer. Open Nautilus. It will open to your brother’s home folder. Navigate to your home folder and open the shared folder by:

click on Computer or System Files (depends on the version of Ubuntu) on the left panel.

Double click on home folder, double click on folder named akumar inside home.

Create a file in the folder. Delete the new file.

Step Four: (optional) Make a link of this folder to your brother’s home folder.

while logged in as your brother, open another window of Nautilus next to the first one, by middle-click or Ctrl +Left click. In your own home folder where the shared folder resides, hold down Ctrl + Shift and drag the shared folder to your brother’s home folder.

Читайте также:  Открыть файл через командную строку linux

Источник

Как сделать общую сетевую папку в Linux (настройка SMB в Linux)

Начните с установки пакетов samba и smbclient.

В Debian, Linux Mint, Ubuntu, Kali Linux и их производных для установки samba выполните команду:

sudo apt install samba smbclient

В Arch Linux, BlackArch и их производных выполните команду:

sudo pacman -S samba smbclient

Следующая команда не сработает, если отсутствует файл /etc/samba/smb.conf. Если у вас тоже нет этого файла, то создаёте его заглушку — к настройке самого файла smb.conf мы вернёмся позже:

sudo touch /etc/samba/smb.conf

Теперь нужно добавить пароль для пользователя Samba. Действует следующее правило: имя пользователя должно быть таким же, как у вашего текущего пользователя, а пароль можно установить иной, отличный от вашего системного пароля.

Для установки пароля Samba, выполните следующую команду:

Если вы хотите, чтобы у пользователя не было пароля, то укажите опцию -n.

Создайте папку, которая станет совместно используемой:

Узнаем абсолютный путь до папки ~/linuxshare:

Откройте для редактирования файл /etc/samba/smb.conf:

sudo gedit /etc/samba/smb.conf

Добавьте туда строки вида:

[ИМЯ_ПАПКИ] comment = Samba на Linux path = /home/ИМЯ_ПОЛЬЗОВАТЕЛЯ/ИМЯ_ПАПКИ valid users = ИМЯ_ПОЛЬЗОВАТЕЛЯ read only = no browsable = yes

Обратите внимание, что все пробелы в строках выше являются обязательными.

Для моих данных это строки:

[linuxshare] comment = Samba на Linux path = /home/mial/linuxshare valid users = mial read only = no browsable = yes

Теперь запустим службу SMB:

sudo systemctl start smb.service

Для добавления службы в автозагрузку выполните:

sudo systemctl enable smb.service

Для подключения к этой общей сетевой папке на Linux нужно использовать IP адреса компьютера Linux.

Создадим файл, чтобы сетевая папка не была пустой:

echo "Документ на Linux" > ~/linuxshare/document.txt

Посмотрите локальный IP адрес компьютера, на котором запущена Linux:

У меня этим IP является 192.168.0.89, а папку, как мы помним, я создал с именем linuxshare, тогда в Windows я перехожу в проводнике во вкладку «Сеть» и подключаюсь к этой папке следующим образом:

Вводим учётные данные (которые мы установили командой smbpasswd):

Видим содержимое совместно используемой папки, размещённой на Linux с помощью SMB:

Для подключения к сетевой папке из консоли Linux, запустите команду вида:

sudo smbclient //IP_АДРЕС/Папка -U ПОЛЬЗОВАТЕЛЬ
sudo smbclient //192.168.0.89/linuxshare -U mial

После ввода пароля нам становится доступным содержимое сетевой папки.

Источник

How to Create a Shared Directory for All Users in Linux?

When multiple users need access to the same set of directories of files then we need to create shared folders to be used by the users. In Linux there is concept of users and groups which can be given certain level of permissions that will enable them to share the data. Below are the steps how to create the shared folders where users can and update the files individually.

Step 1 − Create the folder to be shared

Assuming we are setting up the shared folder from scratch, lets create the folder. The -p will create the directory and would ignore any errors if the directory already exists.

sudo mkdir -p /bigproject/sharedFolder

Step 2 − Create a user group

Next, we create a user group that will be used by users requiring access to this folder.

sudo groupadd SharedUsres

Step 3 − Create a user group

Next we create a user group which will be used by users requiring access to this folder.

sudo groupadd SharedUsres

Step 4 − Give permissions

Now we assign the new group to become owner of the shared folder and give them appropriate permissions which can also be inherited by the subdirectories.

sudo chgrp -R SharedUsers /bigproject/sharedFolder sudo chmod -R 2775 /bigproject/sharedFolder

Step 5 − Add users to the group

Now we add usernames to this group show that they can use the shared folder.

useradd -D -g SharedFolder user1 useradd -D -g SharedFolder user2

Источник

Читайте также:  Континент ап linux где хранятся сертификаты

How to Share a Folder on the Local Network With Ubuntu

It is not difficult to share a folder in Ubuntu 20.04 Linux system and access it over the network in other operating systems, such as Windows. The necessary packages are not enabled by default in Ubuntu 20.04 Linux system. However, you can use the Install Wizard to get the necessary software installed automatically to share a folder. For network sharing, Ubuntu 20.04 Linux system needs a network connection. Verify that your Ubuntu 20.04 Linux system is linked to the router and that it can communicate with other computers on the network. Other computers won’t be able to view or interact with the network shares you establish on Ubuntu if you don’t have a network connection.

Method to Share a Folder on the Local Network With Ubuntu 20.04 Linux System

To share a folder on the local network with Ubuntu 20.04 Linux system, first, you have to install Samba on your system. You have to launch the command line shell in the Ubuntu 20.04 Linux system. Before downloading any new package or software, you need to update your system’s apt packages repository. To upgrade the apt repository, use the following affixed command:

After the update, install Samba by running the following affixed command shown in the screenshot below:

Tap “y” and afterward hit “Enter” to continue with the installation process. The installation of Samba on your machine will take some time.

Once it is installed, type the following cited command to check the status of the Samba operating service:

The output display indicates it is in “Active” (running) status. Now, we will change the firewall access guidelines to permit the “Samba” profile.

Rules will be updated after the execution of the command displayed above.

After installing Samba, we can now use the default Ubuntu file management application “Nautilus” to exchange folders or directories. Let’s take a look at how to use the Nautilus file manager to exchange directories. We have created a folder titled “kalsoom”. We will share this folder and use it in our complete guide. Navigate to the file manager and select a folder to share over your local network. Next, choose the “Local Network Share” selection from the displayed list items:

Читайте также:  Команда линукс свой айпи

The screen shall show the following folder sharing dialogue. To share the folder, you must check the boxes displayed in the following attached screenshot and then click on the “Create Share” button:

The following dialogue will appear on your system. After, tap the “Add the permissions automatically” button.

If you are a guest user, no user account authentication is required to access Samba shared folders. Everybody on the network can access the sharing folder by using guest shares. However, to grant permitted access to Samba shares, you will need a Samba user account. We have created a user titled “kalsoom”, as shown in the screenshot.

Tap “Enter” after entering a new password for a user. Rewrite the new password and press the “Enter” key once more. The new Samba user has been established successfully, and a new password has been set for the freshly created user, as shown in the attached image:

Now, it is time to access the Samba folder share on the Ubuntu 20.04 Linux system. In the other location section, type the address of Samba shares as seen in the following screenshot:

On your system, the following dialogue will appear, which is displayed in the screenshot below. You have the option of connecting as an “Anonymous” user or even as a “Registered user” in the image below. Type all the required fields, and tap on the “Connect” button.

Tap on the hostname or server. Again, you will be required to enter the following details displayed in the attached screenshot:

You could see that all of Samba’s folders are shared here in the attached screenshot:

The basic method can be utilized by Windows users to connect to Samba shares. Right-click on the “This PC” option in the File Explorer and pick the “Add a Network Location” option from your Windows 10 system.

On the Windows 10 system, the following wizard will pop up. Hit the “Next” button to proceed further.

After that, another new window will pop up on Windows 10 system. Simply select the “Choose a custom network location” option.

Now, you have to write the IP and the user-created for Samba shares in the same pattern shown in the following image. That’s how you can view all shared folders.

Now, in Ubuntu 20.04 Linux system, you can also enable a user by executing the following affixed command displayed in the attached screenshot:

The user will be activated.

Conclusion

We learned how to install Samba on an Ubuntu 20.04 Linux system in this article. We have demonstrated how to use Samba shares to share folders over a local network. I hope you have gained insights from this article to assist in your relevant work.

About the author

Kalsoom Bibi

Hello, I am a freelance writer and usually write for Linux and other technology related content

Источник

Оцените статью
Adblock
detector