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 example The S-do SMB (Server Message Block) mounts:
Type1:listing SMB shared folder through command prompt
#smbclient –L ipadd–u username
Here –L 'll 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 and 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 would ask password to display/mount the share name, however we can specify the password in C Ommand 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 edited fstab file properly. by below commands
#mount –a
This command should does throw any error,
#df –H
This command should show mount from 192.168.0.1 server
List the shared folders provided by an IP address
Smbclient-l 198.168.0.1-u Username%password
Use smbclient like FTP clients
Smbclient//192.168.0.1/tmp-u Username%password
After the execution of the smbclient command succeeds, enter the smbclient environment, and a prompt appears: smb:/> then input? You'll see the supported commands
There are many commands similar to FTP commands, such as CD, LCD, GET, megt, put, mput, and so on. With these commands, we can access the shared resources of the remote host.
Direct one-time use of the smbclient command
Smbclient-c "ls"//192.168.0.1/tmp-u Username%password
And
Smbclient//192.168.0.1/tmp-u Username%password
Smb:/>ls
Function-like
Example, create a shared folder
Smbclient-c "mkdir share1"//192.168.0.1/tmp-u Username%password
If a user shares//192.168.0.1/tmp in a read-only way, it prompts
nt_status_access_denied Making remote Directory/share1
In addition to using smbclient, you can mount remote shared folders via mount and Smbcount
Mount Mount-t cifs-o username=administrator,password=123456//192.168.0.1/tmp/mnt/tmp
Un-mount Umount/mnt/tmp
Use SMBFS to mount a remote share locally and set the Chinese correctly
You need to install the SMBFS package
Use the Mount command to complete, such as (you must give a specific share name, you can get the share name through the smbclient described earlier):
# mount-o Guest-t Smbfs//192.168.0.20/linux/mnt/win_share
When you need to log in:
# mount-t Smbfs-o Username=tridge,password=foobar//fjall/test/data/test
In addition, in order to display Chinese correctly, users with UTF8 as locale (if using Ubuntu or fedora, default is UTF8 locale), add the following options:codepage=cp936 and Iocharset=utf8, which is the Mount command, is written as:
# mount-o Guest,iocharset=utf8,codepage=cp936-t Smbfs//192.168.0.20/linux/mnt/win_share
This is why it is written because the encoding used at the far end is cp936, while the local use is UTF8.
Users with GBK as the locale
# mount-o Guest,iocharset=cp936,codepage=cp936-t Smbfs//192.168.0.20/linux/mnt/win_share
The reason for this is that both the remote and the local are cp936.
Remote mounting from Windows to Linux