Better sh hl
This commit is contained in:
		@@ -29,14 +29,14 @@ There are many tutorials for setting up Samba on Windows or on NAS systems like
 | 
			
		||||
 | 
			
		||||
### Install Samba Server
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo apt update && sudo apt upgrade
 | 
			
		||||
sudo apt install samba smbclient cifs-utils
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Create the `/video` Folder
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo mkdir /video
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -47,7 +47,7 @@ Now, edit the file `/etc/samba/smb.conf`.
 | 
			
		||||
✨ **Tip:** You can use [File Browser](/serveex/files/file-browser) to navigate and edit your files instead of using terminal commands.
 | 
			
		||||
\::
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo vim /etc/samba/smb.conf
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -75,47 +75,47 @@ Since we're using a secured share, we need to create a user and group to access
 | 
			
		||||
 | 
			
		||||
Create the group:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo groupadd smbshare
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Give the group control over the `/video` folder:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo chgrp -R smbshare /video
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Set inherited permissions:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo chmod 2775 /video
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Now add a no-login user — this user cannot log into the server but can access Samba.
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo useradd -M -s /sbin/nologin sambauser
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Add the user to the `smbshare` group:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo usermod -aG smbshare sambauser
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Set a Samba password:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo smbpasswd -a sambauser
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Enable the Samba account:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo smbpasswd -e sambauser
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo ufw allow from remote-ip to any app Samba
 | 
			
		||||
::
 | 
			
		||||
```
 | 
			
		||||
@@ -128,7 +128,7 @@ sudo ufw allow from remote-ip to any app Samba
 | 
			
		||||
 | 
			
		||||
### Install Required Packages
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo apt update && sudo apt upgrade
 | 
			
		||||
sudo apt install cifs-utils
 | 
			
		||||
```
 | 
			
		||||
@@ -137,7 +137,7 @@ sudo apt install cifs-utils
 | 
			
		||||
 | 
			
		||||
We will create a folder on our local machine where the remote `/video` folder will be mounted — e.g., `/mnt/video`.
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo mkdir /mnt/video
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -147,7 +147,7 @@ To avoid typing our username and password every time, create a `.credentials` fi
 | 
			
		||||
 | 
			
		||||
Create it in the `/smb` folder:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo mkdir /smb
 | 
			
		||||
sudo vi /smb/.credentials
 | 
			
		||||
```
 | 
			
		||||
@@ -166,7 +166,7 @@ Press `Esc`, then `:x` and `Enter` to save and exit.
 | 
			
		||||
 | 
			
		||||
Set proper file permissions:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo chmod 600 /smb/.credentials
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -174,7 +174,7 @@ sudo chmod 600 /smb/.credentials
 | 
			
		||||
 | 
			
		||||
Now mount the folder:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo mount -t cifs -o credentials=/smb/.credentials //remote-ip/video /mnt/video
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -182,7 +182,7 @@ Replace `remote-ip` with your `remote-machine`'s IP address.
 | 
			
		||||
 | 
			
		||||
Verify the mount:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo mount -t cifs
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -196,25 +196,25 @@ By default, shares aren't auto-mounted after reboot. To automate this, edit the
 | 
			
		||||
 | 
			
		||||
First, back it up:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo cp /etc/fstab /etc/fstab.bak
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Then add the mount configuration line:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo echo //remote-ip/video    /mnt/video  cifs   _netdev,nofail,credentials=/smb/.credentials,x-systemd.automount,x-systemd.device-timeout=15 0 0 >> /etc/fstab
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Reboot the machine:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo reboot
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
After rebooting, verify the mount:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo mount -t cifs
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -222,6 +222,6 @@ And done!
 | 
			
		||||
 | 
			
		||||
### Unmount the Shared Folder
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
```sh
 | 
			
		||||
sudo umount -t cifs /mnt/video
 | 
			
		||||
```
 | 
			
		||||
		Reference in New Issue
	
	Block a user