Linux mount cifs dfs

Mount Windows DFS share on Debian Linux (Squeeze) using SMB / CIFS protocol produces dns_resolve_server_name_to_ip error

Monero Badge: QR-Code

Howto mount a Windows DFS share on Debian Linux correctly

In order to being able to mount a DFS share correctly you need to install the following tools on your Debian host:

aptitude install smbfs cifs-utils keyutils

After the installation of the tools you will be able to mount the share using on of these methods:

#1 manual mounting a CIFS/SMB directory:

mount.cifs //myDomain.com/dfs_root/Sharename /mnt/cifs_mountpoint -o username=UserName,password=Passw0rd

#2 mounting with AUTOFS (automatic mounting)

Edit the file /etc/auto.master:

Enter a line like this (timeout means: unmount after xx seconds):

/mnt/MyShare /etc/auto.smb --timeout 600

Enter the command to mount your directory (in the example we directly connect the DFS share on the domain controller):

MySMBShareName -fstype=smbfs,rw,soft,username=MyUsername,password=MyPassword ://servername/dfs/folder/subfolder

Save the file and change its permissions (Attention! The file MAY NOT be executable. If it is the AUTOFS daemon won’t parse it):

chmod a-x /etc/auto.smb chmod 600 /etc/auto.smb

Restart the AUTOFS daemon

Check if you can access your share:

cd /mnt/MyShare/MySMBShareName

Источник

Local Workgroup

This would set your mounts on your client to force to max negotiation speed to server at CIFS aka SMB1 aka NT1) and not SMB2 for example. (Commented out option for a higher negotiation protocol, max SMB2 , Win7 revision.)

client max protocol = NT1 #client max protocol = SMB2_10

cifs

winbind, nsswitch.conf

  • Note, cifs needs winbind to work, else it wont be able to resolve the names to IP’s (you can use ip’s instead and negate winbind)
  • Install winbind and fix the line like this in /etc/nsswitch.conf — I had problems putting wins first in the past (cant remember what/why now), seems to work best at the end so it is the last lookup method.
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 wins

ping is easiest way to see if it now works, to add a space you need to use quotes, other methods don’t work. case doesn’t matter.

$ ping "Belkin n+" ping: unknown host Belkin n+
$ ping Belkin\040n+ ping: unknown host Belkin040n+ $ ping Belkin%20n+ ping: unknown host Belkin%20n+ $ ping "Belkin n+" PING Belkin n+ (192.168.2.1) 56(84) bytes of data. ^C64 bytes from 192.168.2.1: icmp_req=1 ttl=64 time=0.436 ms

mount via terminal

$ sudo mkdir /media/Belkin $ sudo mount -t cifs "//BELKIN N+/Voyager/" /media/Belkin -o guest $ tree /media/Belkin | head -6 /media/Belkin ├── apc.php ├── bios │ ├── bios.cfg │ ├── bios.lst │ ├── DQ965GF.IMA.gz

mount via /etc/fstab

Add this line to auto mount. Spaces need to be in octal, other characters can also be too.

  • Note, to test run «sudo mount -a» after editing, however you need to have manually made /media/Belkin if so. If rebooted, the dir will be made automatically.
//BELKIN\040N+/Voyager/ /media/Belkin cifs guest 0 0 #or even somewhat cryptically to stop the average nosey poker looking in your fstab //\102\105\114\113\111\116\040\116\053/\126\157\171\141\147\145\162/ /media/Belkin cifs guest 0 0

AD password change

Troubleshooting

The folder contents could not be displayed. Sorry, could not display all the contents of "XXX XXXXXXXX": Invalid argument
ls: reading directory xxxxx: Object is remote

Make sure you have the correct search domains set to your windows domain name(s) for all parts of the DFS servers it traverses over, this should come from DHCP option 15. You can add these into network manager or directly (but not permanently if using Ubuntu > 12.10) in /etc/resolv.conf. Unmount and remount the shares for this to have any effect. [There is no obvious error in wireshark if this is the problem, but if you look on a machine it works on it will be connecting differently to non FQDN servers, probably the root ones]

Читайте также:  Разница между unix та linux

example resolv.conf from 12.10

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.1.1 search xxx.xx.xx.xx search yyy.xx.xx.xx search xx.xx.xx

Источник

Proper mounting Windows DFS Namespace in Linux / Object is remote

I am struggling to mount a remote CIFS directory on a Ubuntu system at work. The remote folder appears to be working just fine from my Windows 8.1 session (also at work). I could not get normal mounting to work:

$ sudo mount -v -t cifs //1.2.3.4/network ~/z -o username=malat,domain=MY,uid=$(id -u),gid=$(id -g),iocharset=utf8 Password for malat@//1.2.3.4/network: ********* mount.cifs kernel mount options: ip=1.2.3.4,unc=\\1.2.3.4\network,iocharset=utf8,uid=1002,gid=1002,user=mmalaterre,domain=MY,pass=******** mount error(2): No such file or directory Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) 
$ sudo mount -v -t cifs //1.2.3.4/network ~/z -o username=malat,domain=MY,uid=$(id -u),gid=$(id -g),iocharset=utf8,nodfs Password for malat@//1.2.3.4/network: ********* mount.cifs kernel mount options: ip=1.2.3.4,unc=\\1.2.3.4\network,iocharset=utf8,nodfs,uid=1002,gid=1002,user=malat,domain=MY,pass=******** 
$ mount | grep network //1.2.3.4/network on /home/malat/z type cifs (rw,relatime,vers=2.1,cache=strict,username=malat,domain=MY,uid=1002,forceuid,gid=1002,forcegid,addr=1.2.3.4,file_mode=0755,dir_mode=0755,soft,nounix,nodfs,mapposix,rsize=1048576,wsize=1048576,bsize=1048576,echo_interval=60,actimeo=1) 

However there seems to be something not working (related to DFS option I guess). Here are the symptoms:

$ cd ~/z $ ls folder1 folder2 $ ls folder1 subfolder1 $ ls folder2 ls: cannot access 'folder2': Invalid argument 

I can access the folder folder2 just fine from my Windows 8.1 session, so this is not a permission issue. How can I access folder2 from my Linux session ? Here is the tail of dmesg :

[1927958.534353] CIFS: Attempting to mount //1.2.3.4/network [1927958.534403] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount. [1927960.069018] CIFS VFS: DFS capability contradicts DFS flag [1927960.375111] CIFS VFS: Autodisabling the use of server inode numbers on new server. [1927960.375115] CIFS VFS: The server doesn't seem to support them properly or the files might be on different servers (DFS). [1927960.375117] CIFS VFS: Hardlinks will not be recognized on this mount. Consider mounting with the "noserverino" option to silence this message. 
$ cd ~/z $ cd folder2 $ ls subfolder2 $ cd subfolder2/ bash: cd: subfolder2/: Object is remote 
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 19.04 Release: 19.04 Codename: disco 
$ uname -rvo 5.0.0-38-generic #41-Ubuntu SMP Tue Dec 3 00:27:35 UTC 2019 GNU/Linux 
$ cat /etc/request-key.d/cifs.spnego.conf create cifs.spnego * * /usr/sbin/cifs.upcall %k 

Источник

Читайте также:  Настройка active directory astra linux

Mounting Windows DFS Share in Red Hat v. 6.8

I’ve setup a Windows DFS environment. I’m looking to mount specific DFS shares in Red Hat v. 6.8 and up. The only article I’ve come across so far was this:

This article points out that we can mount a drive with a hostname / IP as part of the path. In Windows DFS, we are not using a hostname but rather the domain of the AD network i.e. //Company.local/Public

Has anyone had this issue before? Is it possible to mount a DFS share in Red Hat?

Tag by redhat

  • local_offer Tagged Items
  • redhat
  • Windows Server 2012 R2 star 4.6

User: Jacob Adams

Combatting Rogue URL Tricks

14 Replies

Author T G

This person is a Verified Professional

Obsolesce

Even with DFS, you can still get to a share by using \\hostname\share For example, you could use this:

mount -t cifs -o username=administrator,password=p@ssw0rd,domain=domain.local //server/d$/mnt /mnt

Author Jacob Adams

Hi Tim, Thanks for the follow-up. I have been able to mount directly to a Windows DFS host (DFS1.domain.local\Public) but not to the DFS namespace (Domain.local\Public) itself. Why this is important to mount to the DFS namespace instead of a host, is to prevent any downtime if DFS host goes offline. We don’t want to have any hostnames or IPs as part of the mounting process. Thanks for your help. -Jake

Author T G

This person is a Verified Professional

Obsolesce

BetaJake wrote: Hi Tim, Thanks for the follow-up. I have been able to mount directly to a Windows DFS host (DFS1.domain.local\Public) but not to the DFS namespace (Domain.local\Public) itself. Why this is important to mount to the DFS namespace instead of a host, is to prevent any downtime if DFS host goes offline. We don’t want to have any hostnames or IPs as part of the mounting process. Thanks for your help. -Jake

Author Jacob Adams

Hi Tim, Yes, I’ve added add the appropriate configurations to the request-key.conf file:
create cifs.spnego * * /usr/sbin/cifs.upcall -c %k
create dns_resolver * * /usr/sbin/cifs.upcall %k
I’m receiving error: mount error(6): No such device or address I know the permissions and path are correct. Any ideas? Thank you, Jake

Читайте также:  Kali linux hot keys

Author T G

This person is a Verified Professional

Obsolesce

Hi Tim, Yes, I’ve added add the appropriate configurations to the request-key.conf file:
create cifs.spnego * * /usr/sbin/cifs.upcall -c %k
create dns_resolver * * /usr/sbin/cifs.upcall %k
I’m receiving error: mount error(6): No such device or address I know the permissions and path are correct. Any ideas? Thank you, Jake No, unfortunately that’s as far as I can go with it. If you can’t get it working you may just have to go with a hostname to get it done. Or at least a DNS alias record so if the DFS server share goes down, all you have to do is change the alias pointer on the dns server rather than fix all the mount points on your Linux servers. I’ve found if you do too many under the hood things in Linux to get it to work with a specific Windows function, it’ll just end up breaking later anyways when something changes. like a Linux update or who knows what.

Источник

Оцените статью
Adblock
detector