Get the App
SLTechnology News&Howtos  ›  Servers  › 

Samba simple and fast file sharing

Shulou Source: shulou.com Published: 2022-06-03 08:38:52 09月20日 Update

Samba simple and fast file sharing

Samba is a software component that interoperates between linux,unix and windows.

The required software includes: samba (server-side software package), samba-client (client-side software package) and samba-common (common file package) samba is composed of two daemons, smbd and nmbd, and the default listening ports of smbd are TCP 139,445.

① Quick install and configure Samba Server

Yum-y install samba

② creates a shared directory

Mkdir / common

Chmod 777 / common

Echo "hello" > / common/smb.txt # create a test file

③ modify configuration file

The default configuration file for Samba is / etc/samba/smb.conf

Vim / etc/samba/smb.conf

[common] # share name is common

Comment = common share # sharing comments

Path = / common # specify the share path

Browseable = yes # visible to everyone

Guest ok = no # denies anonymous access

Writable = yes # supports writing data

④ creates an access account. The password of the samba share is a separate password, which is different from the system password. It is stored in / var/lib/samba/private by default.

Useeradd-s / sbin/nologin smbuser

Smbpasswd-a smbuser

Smbpasswd parameter options

-a # add account and set password

-x # Delete SMB account

-d # prohibit SMB account

-e # enable SMB account

⑤ Startup Service

Systemctl start smb

⑥ accesses samba shares

Windows can access the directory by entering\ IP in the dialog box to start running.

Linux client access

Smbclient-L / / ip # probe host sharing information

Smbclient-U username / / ip / common # accesses the shared directory

⑦ mounts a shared directory

Mkdir / com

Mount-t cifs / / ip/common / com-o username= username, password= password

Tags: File password software directory account software package service configuration client client server user user name simple and fast two host between information parameter name Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft NVidia MySQL OPPO Reno MariaDB