samba服务配置与测试---smbclient命令行用法

smba 配置的时候,需要注意用户组的配置,可以用smbclient测试,有问题可能看报错。


path = /home/zhuoying.zy/test
public = yes
writable = yes
valid users = user_name
create mask = 0700
directory mask = 0700
force user = user_name
force group = user_group
available = yes
browseable = yes


smbclient  //IP/DIR -U user_name

Enter user_name's password: 
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.25]
tree connect failed: NT_STATUS_NO_SUCH_GROUP


以下转自:http://blog.csdn.net/smstong/article/details/4977976

转自:http://hi.baidu.com/ilovechallenge/blog/item/53698b28bbf657f699250ae0.html
1,列出某个IP地址所提供的共享文件夹 
smbclient -L 198.168.0.1 -U username%password 

2,像FTP客户端一样使用smbclient 
smbclient //192.168.0.1/tmp -U username%password
执行 smbclient命令成功后,进入 smbclient环境,出现提示符: smb:/> 这时输入?会看到支持的命令
这里有许多命令和ftp命令相似,如cd 、lcd、get、megt、put、mput等。通过这些命令,我们可以访问远程主机的共享资源。 

3,直接一次性使用smbclient命令 
smbclient -c "ls" //192.168.0.1/tmp -U username%password
和 
smbclient //192.168.0.1/tmp -U username%password
smb:/>ls 
功能一样的 

例,创建一个共享文件夹 
smbclient -c "mkdir share1" //192.168.0.1/tmp -U username%password 
如果用户共享//192.168.0.1/tmp的方式是只读的,会提示 
NT_STATUS_ACCESS_DENIED making remote directory /share1 

4,除了使用smbclient,还可以通过mount和smbcount挂载远程共享文件夹 
挂载 mount -t cifs -o username=administrator,password=123456 //192.168.0.1/tmp /mnt/tmp 
取消挂载 umount /mnt/tmp

你可能感兴趣的:(linux系统)