zoukankan      html  css  js  c++  java
  • remote mounting from windows to linux

    8 Ways To Mount SMBfs (SAMBA FILE SYSTEM) In Linux.

    Sep 8, 2009

    How to Mount smbfs (SAMBA file system) permanently in Linux.In this post I am going to give some examples how to do SMB (Server Message Block) mounts..

    Type1 : Listing SMB shared folder through command prompt

    #smbclient –L ipadd –U username

    Here –L will specify listing of SMB share for the server with ipadd

    Or

    #smbclient //192.168.0.1/share1 –U username

    Example :

    #smbclient –L 192.168.0.1 –U root

    Type2 : Mounting SMB share on local folder by using smbmount command

    #smbmount //ipadd/sharename /mountpoint –o username=userid,workgroup=workgroupname

    Example :

    #smbmount //192.168.0.1/share1 /mnt –o username=steev,workgroup=test

    Type3 : Mounting SMB share by using mount command

    #mount –t smbfs ipadd:/sharename /mountpoint –o username=userid,workgroup=workgroupname

    Or

    #mount –t smbfs //ipadd/sharename /mountpoint –o username=userid,workgroup=workgroupname

    Example :

    #mount –t smbfs 192.168.0.1:/share1 /mnt –o username=surendra,workgroup=test

    Type4 : Mounting CIFS (Common Internet File System) is nothing but a advanced SMB file system implementation which support RAP (Remote Access Protocol)

    #mount –t cifs ipadd:/sharename /mountpoint –o username=userid,workgroup=workgroupname

    Example :

    #mount –t cifs 192.168.0.1:/share1 /test –o username=Surendra,workgroup=test

    Type5 : All the above commands will ask password to display/mount the share name, however we can specify the password in command itself as below

    #mount -t smbfs -o username=userid,workgroup=workgroupname,password=XXXXX //ipadd/sharepoint /mountpoint/

    Example :

    #mount –t smbfs –o username=Surendra,workgroup=test,password=xylBJRS8 //192.168.0.1/share1 /test

    Type6 : Mounting permanently by editing /etc/fstab file, below is the fstab file entry example

    #vi /etc/fstab//192.168.0.1/share1 /test smbfs rw,user,username=surendra,password=xylBJRS8 0 0

    Save and exit the file and conform that you edited fstab file properly. By below commands

    #mount –a

    This command should not throw any error,

    #df –H

    This command should show mount from 192.168.0.1 server

    列出某个IP地址所提供的共享文件夹
    smbclient -L 198.168.0.1 -U username%password

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

    直接一次性使用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

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

    使用smbfs将远程共享挂载到本地并正确设置中文

    您需要安装smbfs软件包

    使用mount命令完成,如(必须给出具体的共享名,可以通过前面介绍的smbclient获得共享名):

    # mount -o guest -t smbfs //192.168.0.20/linux /mnt/win_share
    

    需要登录时:

    # mount -t smbfs -o username=tridge,password=foobar //fjall/test /data/test
    

    另外,为了能正确显示中文,以utf8为locale的用户(如果使用UbuntuFedora,默认就是utf8的locale)加入以下选项:codepage=cp936iocharset=utf8,即mount命令写为:

    # mount -o guest,iocharset=utf8,codepage=cp936 -t smbfs //192.168.0.20/linux /mnt/win_share
    

    这所以这样写,是因为远端使用的编码是cp936,而本地使用的是utf8

    以gbk为locale的用户则

    # mount -o guest,iocharset=cp936,codepage=cp936 -t smbfs //192.168.0.20/linux /mnt/win_share
    

    这样写的原因是远端和本地都是cp936

  • 相关阅读:
    iOS UITextField限制输入长度
    SpringBoot 统一异常处理
    idea+springboot+freemarker热部署
    JAVA 实现链表
    mysql 添加新用户 赋予权限
    Spring MVC 集成 Redis集群
    js获取当前日期时间及其它操作
    MySQL Error Codes MYSQL的错误代码
    js数组 删除元素
    JS table form 序列化提交
  • 原文地址:https://www.cnblogs.com/linuxbo/p/4286589.html
Copyright © 2011-2022 走看看