Get the App
SLTechnology News&Howtos  ›  Servers  › 

Note: linux accesses windows share

Shulou Source: shulou.com Published: 2022-06-02 02:31:58 09月20日 Update

There are two ways for Linux to access Windows shares:

Method 1: mount mount

Create a mount point:

[root@bogon mnt] # mkdir / mnt/myshare

Mount:

[root@bogon mnt] # mount-t cifs-o username=lee / / 192.168.8.1/Share / mnt/myshare/

The specific meaning of several parameters:

Cifs:Common Internet File System,# can be understood as a network file system. The user name of usrname:# to access the shared folder password:# access password (I did not enter it clearly here) / / 192.168.66.198/share:# indicates the address of the network folder. Note that / cannot be added here. If it is / / 192.168.66.198/share/, the following error will be reported: mount: / / 192.168.66.198/share/ is not a valid block device

Boot and mount automatically:

[root@bogon mnt] # vim / etc/fstab / / 192.168.8.1/Share / mnt/myshare cifs defaults,username=lee,password=* 0 2 [root@bogon mnt] # mount-a

Method 2: samba-client

Check to see if Sambaclient is installed.

[root@bogon myshare] # rpm-qa | grep samba

If not, install the Samba client:

[root@bogon myshare] # yum install samba-client

View the windows shared folder:

[root@bogon myshare] # smbclient-U lee-L / / 192.168.8.1

Manipulate windows shared folders:

[root@bogon myshare] # smbclient-U lee / / 192.168.8.1/ShareEnter lee's password: Domain= [DANNYLEE] OS= [Windows 10 Enterprise 10240] Server= [Windows 10 Enterprise 10240] smb:\ > # indicates the internal command to enter sambaclient: smb:\ > help # View smb available commands smb:\ > help get # View specific commands HELP get: [local name] get a filesmb:\ > ls # View files in a shared folder

Download a file from the shared folder:

Smb:\ > get 3389.txt / lee/bak/test.txt

Upload a file to a shared folder:

Smb:\ > put / lee/bak/test.txt test.txt

Other orders are brief.

Tags: File folder command method network next usage parameter meaning address customer client password plaintext user user name system error will report input Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Shulou Technology Microsoft MariaDB OPPO Reno