CLI mounting of FreeNAS drive from local computer

Status
Not open for further replies.

smokinjo

Cadet
Joined
Sep 13, 2016
Messages
5
I want to be able to access my FreeNAS from a local server.

I am slowly learning Linux and I have only accessed my FreeNAS from my Mac, Linux and Windows from the GUI.

I have a server that needs access to the FreeNAS in order to back up files.

I am using Debian command line.

How can I mount the FreeNAS server/drives and gain access to it to transfer files to it?

Thanks for any answers, or even webpages which would guide me.


Joseph
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504

smokinjo

Cadet
Joined
Sep 13, 2016
Messages
5
Hello Dan35

Thanks for the feedback.

I was able to install smbclient. I can see the FreeNAS with the smbclient -L command.

Now, to mount the drive and transfer files to and from it.
I was told to add this to the fstab file:
Code:
//<IPAddress>/<share name>	/mnt/smb   cifs	password=,uid=1000,umask=000	0	0

It also says if I have a password, I would add this option:
Code:
credentials=/usr/local/etc/whisper.credentials

Where do I add this? To the end of the above line?

If I have a password, like I do, I need to modify this file:
/usr/local/etc/whisper.credentials

And add this info:
Code:
  username=<DomainName>/<username>
  password=<password>

I did this already.
It suggests that I add the following option:
Code:
file_mode=0664,dir_mode=0775,gid=adm

Where would I put this?

Is this needed? It will set the permissions. But, what is the difference between dir-mode and file-mode?

Thanks!
 
Last edited by a moderator:

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I don't think I can offer further help, as I really don't do much with Debian. But it sounds like your questions are Debian questions, not FreeNAS questions.
 

smokinjo

Cadet
Joined
Sep 13, 2016
Messages
5
Thanks for the feedback. What I was able to understand, this is not really a Debian issue, it is figuring out how to use SMBClient.

There might be basic instructions, but I have not yet worked out how to connect and then access the FreeNAS share.

Being SMBClient, it is used to access a Samba share, show this indirectly involves FreeNAS:)

Any help would be appreciated.

Thanks

Joseph
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
@smokinjo Don't know if you've sorted this out but this page gets to the basics and avoids getting bogged down in the fine detail:

https://wiki.samba.org/index.php/Mounting_samba_shares_from_a_unix_client

In the way of an example, to show available SAMBA shares in linux, use smbclient or smbtree:

Code:
root@bunsen-vm:~# smbtree -b -N
WORKGROUP
	\\FREENAS				FreeNAS Server
		\\FREENAS\IPC$			  IPC Service (FreeNAS Server)
		\\FREENAS\nas_share		
		\\FREENAS\homes			  Home Directories
		\\FREENAS\a_share			
root@bunsen-vm:~# smbclient -L 192.168.0.114 -U%
WARNING: The "syslog" option is deprecated
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.7.0]

	Sharename	   Type	  Comment
	---------	   ----	  -------
	a_share		 Disk	
	homes		   Disk	  Home Directories
	nas_share	   Disk	
	IPC$			IPC	   IPC Service (FreeNAS Server)
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.7.0]

	Server			   Comment
	---------			-------
	FREENAS			  FreeNAS Server

	Workgroup			Master
	---------			-------
	WORKGROUP			FREENAS



In this case the zfs dataset shared as "a_share" is owned by user chris (uid 1000, gid 1000) on FreeNAS.

A manual non-persistent:

Code:
root@bunsen-vm:~# mount -v -t cifs -o user=chris,uid=1000,gid=1000,credentials=/home/chris/creds/smb //192.168.0.114/a_share /home/chris/CIFS
mount.cifs kernel mount options: ip=192.168.0.114,unc=\\192.168.0.114\a_share,uid=1000,gid=1000,user=chris,pass=********
root@bunsen-vm:~#


Check actual full mount arguments used, including default arguments:

Code:
root@bunsen-vm:~# mount | grep CIFS
//192.168.0.114/a_share on /home/chris/CIFS type cifs (rw,relatime,vers=1.0,cache=strict,username=chris,domain=FREENAS,uid=1000,forceuid,gid=1000,forcegid,addr=192.168.0.114,unix,posixpaths,serverino,mapposix,acl,rsize=1048576,wsize=65536,echo_interval=60,actimeo=1,user=chris)
root@bunsen-vm:~#


Note with a vers=1.0 mount the "unix" agrument means Unix extension is understood and data will have the unix perms as on dataset. With higher SAMBA versions, Unix extension are not understood and a file_mode & dir-Mode of 0755 is forced - ie. DOS like perms, e.g:

Code:
root@bunsen-vm:~# mount -v -t cifs -o vers=3.0,user=chris,uid=1000,gid=1000,credentials=/home/chris/creds/smb //192.168.0.114/a_share /home/chris/CIFS
mount.cifs kernel mount options: ip=192.168.0.114,unc=\\192.168.0.114\a_share,vers=3.0,uid=1000,gid=1000,user=chris,pass=********
root@bunsen-vm:~# mount | grep CIFS
//192.168.0.114/a_share on /home/chris/CIFS type cifs (rw,relatime,vers=3.0,sec=ntlmssp,cache=strict,username=chris,domain=FREENAS,uid=1000,forceuid,gid=1000,forcegid,addr=192.168.0.114,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1,user=chris)
root@bunsen-vm:~#


In this example, the user "chris" exists on both FreeNAS and Linux with the same uid/gid. The username/password combo SAMBA authenticates against must be that of a valid SAMBA account on FreeNAS. (in my example "bunsen-vm" is a debian based desktop)

Once you sorted out how you want to mount the FreeNAS SAMBA share in linux, then convert your manual mount command into a "/etc/fstab" entry for a peristent mount.
 
Last edited:
Status
Not open for further replies.
Top