Mount Remote Windows Share from Centos

mount remote windows share from centos

The mount.cifs file is provided by the samba-client package. This can be installed from the standard CentOS yum repository by running the following command:

yum install samba samba-client cifs-utils

Once installed, you can mount a Windows SMB share on your CentOS server by running the following command:

Syntax:

mount.cifs //SERVER_ADDRESS/SHARE_NAME MOUNT_POINT -o user=USERNAME

SERVER_ADDRESS: Windows system’s IP address or hostname

SHARE_NAME: The name of the shared folder configured on the Windows system

USERNAME: Windows user that has access to this share

MOUNT_POINT: The local mount point on your CentOS server

I am mounting to a share from \\10.11.10.26\snaps

Make a directory under mount for your reference

mkdir /mnt/mymount

Now I am mounting the snaps folder from indiafps02, User name is the Domain credentials, i.e. Mydomain in this case

mount.cifs //10.11.10.26/snaps /mnt/mymount -o user=Girish.KG

Now you could see the content by typing

ls /mnt/mymount

So, after performing your task, just fire umount command

umount /mnt/mymount

That's it. You are done.

mount - samba with CentOS 7

i put vers=2.0

mount -t cifs -o vers=2.0,uid=1010,gid=1011,username=,password= //10.219.56.2/SysWOW64 share

Mounting a windows share in Windows Subsystem for Linux

Assuming the host Windows OS can access a file share at "\\servername\sharename", try this command in bash. You will need to be root:

mkdir /mnt/mountedshare
mount -t drvfs '\\servername\sharename' /mnt/mountedshare

The single quotes are important!

Worked for me with a SharePoint Online UNC path. The permissions are screwy though. I can navigate through the folders and see the filenames, but I can't read files. So need to figure out the permissions thing. Let me know if you get anywhere with that.

How do I mount a remote Linux folder in Windows through SSH?

Back in 2002, Novell developed some software called NetDrive that can map a WebDAV, FTP, SFTP, etc. share to a windows drive letter. It is now abandonware, so it's no longer maintained (and not available on the Novell website), but it's free to use. I found quite a few available to download by searching for "netdrive.exe" I actually downloaded a few and compared their md5sums to make sure that I was getting a common (and hopefully safe) version.

Update 10 Nov 2017
SFTPNetDrive is the current project from the original netdrive project. And they made it free for personal use:

We Made SFTP Net Drive FREE for Personal Use

They have paid options as well on the website.

Mount SMB/CIFS share within a Docker container

Yes, Docker is preventing you from mounting a remote volume inside the container as a security measure. If you trust your images and the people who run them, then you can use the --privileged flag with docker run to disable these security measures.

Further, you can combine --cap-add and --cap-drop to give the container only the capabilities that it actually needs. (See documentation) The SYS_ADMIN capability is the one that grants mount privileges.

How to `ls` a remote folder?

Your current method of using ~/.gvfs/ is fine, but you don't need pcmanfm for that – you can use gvfs-mount to connect to the share. Additionally, tools such as gvfs-ls and gvfs-cp will accept your smb:// URI.

$ gvfs-mount smb://HOST/SHARE/

$ gvfs-ls smb://HOST/SHARE/

In recent gvfs versions the location is $XDG_RUNTIME_DIR/gvfs/ (aka /run/user/$UID/gvfs/), and the subdirectory names have become more machine-readable:

$ ls /run/user/$UID/gvfs/smb-share:server=HOST,share=SHARE/

In older versions:

$ ls ~/.gvfs/"SHARE on HOST"/

(Remember to quote spaces within path names.)


Specifically for Samba, you can use the smbclient program, or mount the share on the VFS layer by using mount -t cifs. (The latter is, unfortunately, limited to root.)

$ smbclient //host/share

# mount -t cifs //host/share /mnt

(For other kinds of filesystems, such as SFTP and FTP, sshfs and curlftpfs exist respectively.)



Related Topics



Leave a reply



Submit