How do I mount a CIFS share?
I'm using Ubuntu 11.10, and am trying to mount a freenas server. I have the server set to share in cifs and nfs with no luck.
I have tried smbmount //192.168.1.### /mnt/
I am not new to Ubuntu but am nowhere near a power user, so I'd prefer a GUI option if available.
How do I mount a cifs share in 11.10?
Solution 1:
There is pyNeighborhood which is a gui for mounting samba shares and available in the software centre for download.
There is a good article located here on how to set it up and use it.
First install cifs utils
sudo apt-get install cifs-utils
Alternatively, the basic terminal command is :
mount -t cifs -o username=USERNAME,password=PASSWD //192.168.1.88/shares /mnt/share
If you'd like to see your mount in Nautilus it would be good to create a subfolder first in /media/USERNAME/ for example:
mkdir /media/paul/cifsShare
also, password could ommited in the mount command for example (will also demonstrate file/folder modes):
sudo mount -t cifs //nas-server/cifsShare /media/paul/cifsShare -o username=paulOnNAS,iocharset=utf8,file_mode=0777,dir_mode=0777,soft,user,noperm
in this case you'll be asked for the password (actually for 2 passwords) on the mounting moment.
Have a read through the Samba documentation here on how to do it and set it up correctly to mount on start up etc.
Solution 2:
It's as map7 said, but if you don't want to use root permissions every time you change a file on the drive, then you'll have to mount to a user folder, and make sure the gid and uid are set to your username.
The command setting them:
mount -t cifs -o username=USERNAME,password=PASSWD,uid=$USER,gid=$USER //192.168.1.88/shares ~/mnt/share
Note that mnt
folder was created in ~/mnt/share
instead of /mnt/share
.
Also you can leave out password=PASSWD if you want it to prompt you instead of you having it in the command, which is potentially stored in your shell's history:
mount -t cifs -o username=USERNAME,uid=$USER,gid=$USER //192.168.1.88/shares ~/mnt/share
Solution 3:
1) My samba share shows in Caja (the ubuntu 16.04 „explorer“) as
smb://thinkpad/ddrive/
This is a good lithmus test, there are no connection/path issues.
(caveat: If you get asked by caja about password credentials from your windows machine, you might want to switch Domain from WORKGROUP to the name of the machine, i.e. ‘thinkpad’. Then the truly local login credentials of your drive should do.)
2) If that works, here comes the command:
sudo mount -t cifs -o username=frank //thinkpad/ddrive /mnt/ddrive
- Make sure beforehand, /mnt/ddrive exists as an empty directory.
- You cold also add a
,password=supersecret
directly (no space) after username=, but you can also wait for being prompted, when you enter the command.
Solution 4:
I disagree with the claim that root is always necessary to make cifs connections go. It is true, it is always needed for CLI smbmount, but a file manager such as nautilus has ability to mount a cifs share and it is not necessary to be root.
I don't use Gnome, but I still have Nautilus installed. Run this in a terminal to prevent having it try to take over the desktop
$ nautilus --no-desktop &
In Ubuntu 16.04, left side tree menu has "Connect to Server" on the bottom. Click that, the suggestion is type "smb://foo.example.com". smb is old word for "cifs", and if you put in your server and share with smb:// at beginning, connection does work! I promise. If your share is a named thing, it is required after a slash, "smb://foo.example.com/myshare".
I've used other file managers in same way. Protocol has to be "smb://".
Solution 5:
-
You can put all those details in /etc/fstab so you can have directories mounted on system startup. If windows or SMB server is on IP address 192.168.1.1
/etc/fstab //192.168.1.1/SharedFolder/ /mnt/linux_smb cifs username=winuser,password=TopSecret 0 0
-
Create directory as linux mount point
mkdir /mnt/linux_smb chmod 755 /mnt/linux_smb
-
For the first time mount this manually
mount -a
-
Eventual errors can be found by
dmesg | tail