Accéder au contenu principal

How to turn off the microphone in Ubuntu or Linux Mint?

How to create a network share in Ubuntu?



Several methods are possible to set up a network share in Ubuntu (and its official variants Xubuntu, Kubuntu, Lubuntu, ...) in order to easily exchange files with other computers on the same network. Here we will see how to do it with the Samba protocol.


Introduction

Several protocols allow you to share folders on a local network. The two main ones are:


SMB (Server Message Block): originally on Windows with the old name CIFS (Common Internet File System). Samba is its open-source version for Linux systems.

NFS (Network File System): initially intended for Unix systems (including Linux), but also available for Windows or Mac.

In this tutorial, we will be using Samba to create a network share in Linux Mint. Indeed, this protocol has several advantages:


most OS (hence Ubuntu) support access to shared resources through the latter.

Setting up a network share in Ubuntu via Samba is easy once the additional packages are installed.

Install Samba to create network shares in Ubuntu

As said before, to be a client of an SMB OR CIFS share (access it), in Ubuntu, there is nothing to install. But if you want to create a share on your machine and therefore make it a kind of server, you have to install the samba package.


To do this, open a terminal and run the following command:


sudo apt install samba

Ubuntu offers its installation through the graphical interface, if it is not on the system, when you activate a share:


as well as on recent versions of Kubuntu:


During installation, your user account is added to the sambashare group. To add other users who can share their personal folders on the network, add them with the following command:


sudo adduser username sambashare

adduser: command to add a user. But it also allows you to add a user to a defined group. Here sambashare.


username: replace with your username.


Then restart your computer.


Allow incoming connections for samba in Ubuntu's firewall

On Ubuntu, UFW (Uncomplicated Firewall) is the tool for configuring the Linux kernel firewall (Netfilter). But it also has a graphical interface: Gufw. However, it is not installed by default on Ubuntu and its variants.


To install Gufw, do:


sudo apt install gufw

By default, UFW is not active (Personal Folder Profile in Gufw). In this case, there is no need to add any rules to allow inbound connections to samba. They are all already ...


However, if UFW is active (for example, if you use the Desktop or Public profiles in Gufw), the firewall blocks incoming connections. You must therefore create / add rules to authorize them from your local network on the ports used by Samba:


137 in TCP and UDP (NetBIOS Name Service)

138 in UDP (NetBIOS Datagram Service)

139 in TCP (NetBIOS Session Service)

445 in TCP and UDP (Windows Shared Folder Services)

(optional) 135 in TCP and UDP (RPC Service Locator) for sharing with Windows machines older than VISTA.

Check the status of UFW

In a terminal, do:


sudo ufw status

And you will have as result: State: Inactive or State: Active


This can also be checked in Gufw:


Add a rule to the Ubuntu Firewall (and variants) with Gufw

Open the Firewall Configuration Tool (Gufw).


Then go to the Rules tab (1). And click + (2) to add a rule.


In the Add rule to firewall window:


go to the Advanced tab (1). Then complete the required information:


(2) Name of the rule for easier identification.

(3) Rule security policy (Allowed in this case)

(4) Connection direction for which it applies (Enter in this case)

(5) Protocols concerned

(6) Definition of the source. To restrict access only to your local network enter the IP address and the mask of the latter. For example, if your IP is 192.168.0.x and the mask is 255.255.255.0, then the network IP is 192.168.0.0 and the subnet mask in short format will be 24. For this field, no need to define any Harbor.

If you do not know the IP of your network, click the copy IP address icon icon. This will copy your computer's IP to the Source IP field. Then replace the last digit with 0 to get the IP of your network.


(7) Definition of the destination. Complete the Ports field with those to authorize.

And do Add. The window does not close. So you can add another rule directly. Repeat the operation for all affected ports. Finally, once all the rules have been added, click Close.


Add a rule to the Ubuntu Firewall (and variants) from the command line

The authorization of a connection is done in this way


sudo ufw allow | deny | reject | limit [proto PROTOCOL] [from ADDRESS [port PORT] [to ADDRESS [port PORT]] [comment 'COMMENT']

For example: to allow incoming connections for samba on a local network in 192.168.0.x, the rules to add would be:


sudo ufw allow from 192.168.0.0/24 to any port 137 comment 'NetBIOS Name Service'

sudo ufw allow proto udp from 192.168.0.0/24 to any port 138 comment 'NetBIOS Datagram Service'

sudo ufw allow proto tcp from 192.168.0.0/24 to any port 139 comment 'NetBIOS Session Service'

sudo ufw allow from 192.168.0.0/24 to any port 445 comment 'Windows shared folder services'

And this optional rule:


sudo ufw allow from 192.168.0.0/24 to any port 135 comment 'RPC service locator'

Or, if you want to allow all connections to samba regardless of the originating network, you can do:


sudo ufw allow samba

And eventually :


sudo ufw allow 135

Finally, check that the rules are added with:


sudo ufw status


Create a network share in Ubuntu and its variants

Create a network share in Ubuntu or Ubuntu Budgie through the graphical interface

To create a network share in Ubuntu, go to the file browser and right click on the folder to share.


So in the menu choose Sharing options or Property then Share tab. This takes you to the sharing configuration window.


(1) Validate the option to share the folder and have access to the settings.

(2) Enter a name for the share.

(3) Description is optional

(4) Check this option if you want to give the right to create, modify and delete on this folder to all users who will connect. But be careful, checking this option will also modify the rights on the local folder if the folder does not already have these rights.

(5) Check this option if you allow users without an account to connect to this share (not recommended)

Once the configuration is complete, click on Create a share (6).


If option (4) is checked, you have a message to apply the new rights to the folder.



If only users with an account are authorized (option (5) not checked), you must set the samba password for authorized users. To do this, enter the following command in a terminal:


sudo smbpasswd -a user_account

user_account being to be replaced by the desired one. But it must exist on the system.


Then enter the user's password twice for it to be added.


Create a network share in Kubuntu using the graphical interface

To create a network share in Ubuntu, go to the file browser and right click on the folder to share. Then in the menu choose Property then Share tab (1). So, set up your sharing.


(2) Validate the option to share the folder and have access to the settings.

(3) Give the share a name

(4) Check this option if you allow users without an account to connect to this share (not recommended)

(5) Define the rights for users on this share

And, once the configuration is complete, click OK (6).


So, if needed, set the samba password for the affected users:


sudo smbpasswd -a user_account

user_account being to be replaced by the desired one. But it must exist on the system.


Create a network share from the command line

Some official variants (Xubuntu, Lubuntu and Ubuntu Mate) do not allow authoring through their network sharing interface. It will therefore be necessary to directly modify the configuration file /etc/samba/smb.conf to add network shares. But, don't worry, it's not very complicated ...


This method works for all versions of Ubuntu. But only administrators can add new network share ...


Start by saving the original file:


sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

And to restore it, you just have to do the reverse operation:


sudo cp /etc/samba/smb.conf.bak /etc/samba/smb.conf


Then edit this file:


sudo nano /etc/samba/smb.conf

Use the ← ↑ → ↓ keys to move the cursor. Once the text is inserted, do Ctrl + O to save the modification and Ctrl + X to exit.


So add at the end:


[Name_of_Share]

comment = A comment

path = / home / username / Name_of_shared_folder

browsable = yes

read only = no

guest ok = no

[Name_du_Share]: Name that the shared folder will take on the network

comment: optional, for example a description of the share

path: the path to your folder to share (case sensitive)

browsable = [yes | no]: authorize or not the navigation in the network share


read only = [yes | no]: read-only network share or allow writing for authorized users

guest ok = [yes | no]: (optional) allows or not unauthenticated users (without username) to access the share. If not specified = no.


Then, restart the Samba service:


sudo service smbd restart

And set the password for samba users:


sudo smbpasswd -a user_account

user_account being to be replaced by the desired one. But it must exist on the system.


Also, if you authorize others than your user to create / modify / delete documents, you must give them rights on the folder:


chmod a + w

Access the share on the network

Addresses to personalize according to your configuration ...


under linux

smb: // machine_name / share_name

or


smb: // machine_IP / share_name

under Windows

\\ machine_name \ share_name

or


\\ machine_IP \ share_name

Commentaires

Posts les plus consultés de ce blog

How to turn off the microphone in Ubuntu or Linux Mint?

Does your computer have a built-in microphone? Here is how to mute or disable the microphone in Linux (Ubuntu or Linux Mint) in software. Introduction The easiest way to turn off a microphone is to unplug it. So we can be sure that it is no longer picking up anything ... However, on a laptop with a built-in microphone, you can't do it. On the other hand, it is always possible to deactivate it by software. One solution is to mute the microphone input (not its listening), which is equivalent to deactivating it. This is usually done through the GUI, in the Sound settings of the distribution. But, it is also possible to do it in a terminal. However, on a laptop, the microphone can be linked to the integrated webcam. So to deactivate it, just deactivate the webcam. Finally another solution, a little radical, consists in deactivating the sound card. On the other hand, in this case, of course the microphone will be deactivated, but also the other audio inputs / outputs. And you will not h...

How to enable Num Lock on startup in Linux Mint

On most Linux distributions, the keypad lock (Num Lock or Num Lock key) is inactive on the login screen and must be enabled manually. But, here's how to turn on Num Lock on startup in Linux Mint by default. Prerequisites to modify this preference In Linux Mint, it is possible to activate this key at startup by default by modifying, through the graphical interface, the preferences of the login window. But before you can do this, you must first install an additional package numlockx. Numlockx is a utility that allows you to activate the keypad lock at the initialization of an X11 session (graphical session) or by using a command line. It is available from the repositories for Ubuntu and therefore is also available for Linux Mint. To install it, open a terminal and run the following command: sudo apt install numlockx If you prefer to install it with the GUI, look in the numlockx software manager and install it. Enable Num Lock on Boot in Linux Mint To modify the parameters of the conn...

How to change DNS server in Ubuntu?

By default, for an individual, when he connects to the Internet, the DNS server addresses provided in DHCP are those of his Internet service provider. But it is possible to choose others. Here is how to change DNS server in Ubuntu (18.04 and 20.04). Prerequisites Have Ubuntu 16.04 or higher Introduction to DNS What is a DNS server? DNS is the abbreviation for Domain Name System. A DNS server is a system whose purpose is to convert an Internet address (www.domainname.ext) into an IP address (physical address of machines connected to a network). This is called domain name resolution. So, for example when you type in your browser www.wikipedia.fr, the DNS server converts the path to the IP address: 78.109.84.114. You can find out this IP address by pinging the domain. For example : ping wikipedia.fr and under Linux you will have an answer of this type PING wikipedia.fr (78.109.84.114) 56 (84) bytes of data. 64 bytes from wikimedia2.typhon.net (78.109.84.114): icmp_seq = 1 ttl = 51 time = ...