# How to CIFS Mount?

**URL:** <https://forums.suse.com/t/how-to-cifs-mount/1320>\
**Category:** RancherOS\
**Created:** [December 22, 2015, 9:04am UTC](https://forums.suse.com/t/how-to-cifs-mount/1320 "2015-12-22T09:04:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forums.suse.com/u/peter)\
**Post date:** [December 22, 2015, 9:04am UTC](https://forums.suse.com/t/how-to-cifs-mount/1320/1 "2015-12-22T09:04:32Z")

</div>

Hi,

has somebody managed to mount CIFS volumes in RancherOS? NFS works nicely in my configuration (see below) but CIFS does not work at all…

sudo vi /var/lib/rancher/conf/cloud-config.yml

> mount -t nfs 192.168.178.123:/volume/abc /mnt/abc  
> mount -t cifs -o credentials=/root/.smbcredentials [//192.168.178.123/bcd](https://192.168.178.123/bcd) /mnt/bcd

Do you have any suggestions?

Best regards

Peter

---

<div class="post-metadata">

**Author:** ![sjiveson](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/sjiveson/32/966_2.png) [@sjiveson](https://forums.suse.com/u/sjiveson)\
**Post date:** [January 22, 2016, 2:49pm UTC](https://forums.suse.com/t/how-to-cifs-mount/1320/2 "2016-01-22T14:49:17Z")

</div>

I don’t believe you can using the default console as no rpcbind package is present for mounting any type of remote file system.

Switching to the ubuntu-console should make this possible (as at worst you can just install the package).

---

<div class="post-metadata">

**Author:** ![mek1](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@mek1](https://forums.suse.com/u/mek1)\
**Post date:** [June 19, 2017, 8:14pm UTC](https://forums.suse.com/t/how-to-cifs-mount/1320/3 "2017-06-19T20:14:57Z")

</div>

Hello,

I had a similar question and was struggling to get it working on our internal/private cloud. Here’s a stripped down version that will get you up and running.

> ```
> #cloud-config
> hostname: namehere
> rancher:
> console: ubuntu
> network:
> interfaces:
> eth*:
> dhcp: true
> sysctl:
> vm.max_map_count: 262999
> services:
> rancher-agent1:
> image: rancher/agent:v1.2.2
> command: http://1.2.3.4:8080/v1/projects/1a5/scripts/the:unique:codehere
> privileged: true
> volumes:
> - /var/run/docker.sock:/var/run/docker.sock
> environment:
> CATTLE_HOST_LABELS: env=test&os=rancheros
> runcmd:
> - chown -R :rancher /mnt
> - chmod -R g+rw /mnt
> - apt update
> - apt install cifs-utils -y
> - sudo mount //windowsFileServer/sharename -t cifs -o username=theUserName,password=thePassWordHere /mnt
> ssh_authorized_keys:
> - ssh-rsa AAA...
> 
> ```

This line is for running Elasticsearch on the host (off topic but may be helpful to others):

> sysctl:  
> vm.max\_map\_count: 262999

---

<div class="post-metadata">

**Author:** ![mek1](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@mek1](https://forums.suse.com/u/mek1)\
**Post date:** [June 20, 2017, 1:52am UTC](https://forums.suse.com/t/how-to-cifs-mount/1320/4 "2017-06-20T01:52:17Z")

</div>

To add more mounts you can create a yml file on rancheros like the following:

> runcmd:
> 
> - sudo mount //windowsFileServer/sharename2 -t cifs -o username=theUserName,password=thePassWordHere /mnt2

Then ‘sudo ros config merge -i moreMounts.yml’ and reboot. You can find the entry in /var/lib/rancher/conf/cloud-config.yml. This was brought to you in part by [maik](http://forums.suse.com/t/how-to-add-new-ssh-keys-with-ros-config-set-resolved/6192) “No risk, no fun.” 🙂 and documentation.

---

<div class="post-metadata">

**Author:** ![xjm1285](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/xjm1285/32/2729_2.png) [@xjm1285](https://forums.suse.com/u/xjm1285)\
**Post date:** [August 25, 2017, 7:57am UTC](https://forums.suse.com/t/how-to-cifs-mount/1320/5 "2017-08-25T07:57:51Z")

</div>

version 1.0.4, successed

```
#cloud-config
mounts:
- - //192.168.1.1
  - /mnt/smb
  - cifs
  - username=guest,iocharset=utf8,_netdev
```

---

<div class="post-metadata">

**Author:** ![Shalak](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Shalak](https://forums.suse.com/u/Shalak)\
**Post date:** [August 29, 2021, 9:27pm UTC](https://forums.suse.com/t/how-to-cifs-mount/1320/6 "2021-08-29T21:27:59Z")

</div>

Hello! Did you happen to make this work on RancherOS on v1.5.8? Here’s what I’ve set up:

```auto
mounts:
- - "//my_nas_address/share_name"
   - "/mnt/mountpoint"
   - "cifs"
   - "credentials=/root/.cifs,iocharset=utf8,_netdev"

```

And it doesn’t work. The `sudo mount -t cifs "//my_nas_address/share_name" "/mnt/mountpoint" -o credentials=/root/.cifs,iocharset=utf8,_netdev` works (but only after I switched to ubuntu console and I installed `cifs-utils` package.

The tail of dmesg says:

```auto
[15.420866] FS-Cache: Netfs 'cifs' registered for caching
[15.421124] Key type cifs.spnego registered
[15.421142] Key type cifs.idmap registered
[15.422067] Unable to determine destination address.

```

Any ideas on where to look for the issue?

* * *

Edit: I changed the “my\_nas\_address” (which was a DNS-resolved name) with an IP address and now, the error in dmesg is:

```auto
CIFS VFS: No username specified

```

After changing the `credentials=/root/.cifs` to `username=XXX,password=YYY` it stared to work. But I don’t like that workaround.

To solve first issue (`Unable to determine destination address`) I tried adding `name resolve order = host lmhosts wins bcast` to `/etc/samba/smb.conf`, but it sill didn’t accept the host DNS name.

I can live with hardcoded IP address, but I cannot stand the secrets being hardcoded in the config file.

Anyone got an idea on how to make this work with credfile and DNS name?

* * *

edit: The issues above, when unrelated to RancherOS, according to the internet, should be solved by installing `cifs-utils`. So my guess is that the `udev` container of RancherOS does not have it, so it’s impossible to do? Can someone confirm?
