samba

1. Linux server and windows client

On Linux server:

1. install samba:

>sudo apt install samba

2. add samba user:

>sudo smbpasswd -a username

attention: username should be the user of Linux server. You can't create a new one here.

3. configure samba:

>vi /etc/samba/smb.conf

[share]
   comment = share folder
   browseable = yes
   path = /your share folder on Linux server
   create mask = 0777
   directory mask = 0777
   valid users = username of user of Linux server
   force user = nobody
   force group = nogroup
   public = yes
   available = yes

Attention: modify share folder as >sudo chmod -R go+wrx /your share folder. Or may has write permission issue.

4. restart samba server:

>/etc/init.d/smbd restart

 

On Windows client:

client can access the linux server now by:

\\linux-server-ip

 

2. Windows server and Linux client

On Windows 10:

1. enable SMB server on control pane->programs and features->Turn Windows features on or off->SMB*

2. share one folder

On Linux:

1. install samba client

>sudo apt install smbclient

2. install cifs

>sudo apt install cifs*

3. check windows server

>sudo smbclient -L //10.25.132.119 -U windows domain name/your username

Attention: windows use domain/user mode to login, so here -U should followed by domain/user mode.

Here is the result:

Domain=[my domain] OS=[Windows 10 Enterprise 16299] Server=[Windows 10 Enterprise 6.3]

	Sharename       Type      Comment
	---------       ----      -------
	ADMIN$          Disk      Remote Admin
	C$              Disk      Default share
	IPC$            IPC       Remote IPC
	smbtest         Disk      
Domain=[my domain] OS=[Windows 10 Enterprise 16299] Server=[Windows 10 Enterprise 6.3]

	Server               Comment
	---------            -------

	Workgroup            Master
	---------            -------

4. access the server by smbclient

>sudo smbclient //10.25.132.119/smbtest -U windows domain name/your username

Attention:smbtest is the share folder on Windows.

here is the result:

Domain=[my domain] OS=[Windows 10 Enterprise 16299] Server=[Windows 10 Enterprise 6.3]
smb: \> ls
  .                                   D        0  Thu Dec 27 12:28:06 2018
  ..                                  D        0  Thu Dec 27 12:28:06 2018
  tets.txt                            A       18  Thu Dec 27 12:28:06 2018

		241588991 blocks of size 4096. 230191336 blocks available
smb: \> 

at "smb: \> " , we can use commands such as get , put as ftp.

5. mount share folder to /mnt

>sudo mkdir /mnt/pxa

>sudo mount -t cifs -o user=username,vers=1.0 //10.25.132.119/smbtest /mnt/pxa

Attention:

Here don't need windows domain name. Strange.

vers=1.0 could be 2.0, 3.0

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值