FortiClient

Systems

Microsoft

Linux

File Permissions in Linux / Unix Environment - How to Read, Write & Execute?



The type of owners are represented as,


u - User/Owner

g - Group

o - Other

a - All


Lets say if you give the permission as "0123", that means


0 for - User/Owner

1 for - Group

2 for - Other

3 for - All


You can use the following symbolic to change the user permission.


"+" Adds a permission to a file or directory

"–" Removes the permission

"=" Sets the permission and overrides the permissions set earlier.


Here I mentioned the user permission types to anyone can use.


Number Permission Symbol
0 No Permission -
1 Execute -x
2 Write -w-
3 Execute + Write -wx
4 Read r–
5 Read + Execute r-x
6 Read +Write rw-
7 Read + Write +Execute rwx

How to Setup Samba File Shares in Linux – Quick and Easy

 


First of all if you didn't install the Samba, please use the below command to install it.

sudo apt update

sudo apt install samba

And you can check it whether it install or not using the below command.

whereis samba

If it successfully install you can get the some output related to the Samba, if not there is no output to visible.


Before config the Samba in your Linux environment, please backup your previous Samba configuration file if you already have the some Samba sharing settings. if not you can start it as the fresh configuration.


Please use the below command to backup the already having Samba configuration file.

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

As a second step please create the folder you want share using the Samba,

mkdir /<path>/<FolderName>/

Now we can assign the permission for folder.

sudo chmod -R 0775 /<path>/<FolderName>

If you want you can check the permission using below command.

sudo chown -R nobody:nogroup /<path>/<FolderName>

Finally we need to configure the directory as a share using Samba configuration file.

sudo nano /etc/samba/smb.conf

It is locate the above path and you can open it using the above command.

Please add the below settings to the configuration file.

[FolderName]

comment = FolderName

path = /<path>/<FolderName>

public = yes

writable = yes

guest ok = yes

browsable = yes

read only = no

force user = nobody

Then press "Ctrl-O" to save it and "Ctrl-X" to exit from the nano text editor.

After that we need to restart the Samba and please use the below command to restart it.

sudo systemctl restart smbd

or

sudo service smbd restart

Now you can access it from your Windows or Linux environment using the below commands.

Windows,

\\ip-address\<FolderName>

Linux,

smb://ip-address/<FolderName>