[SOLVED] Samba Entry of fstab to mount windows shared folder on Linux machine
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi TB0ne,
I did googled before posting here. Thanks for the link and code. But for some reasons (may be my silly mistake), it is not working for me.
My Win XP Pro machine name is testwinbox and my workgroup name in Win XP Pro and smb.conf is wrkgrp
I tried your code posted by you as well as some more permutation & combinations, but somehow its not working
I am trying to mount a CIFS share as SMBFS is throwing the below error.
Code:
[root@server ~]# tail -1 /etc/fstab
//192.168.1.150//D /winshare smbfs uid=testwinbox,username=vikas,password=vikas27,workgroup=wrkgrp 0 0
[root@server ~]#
[root@server ~]# mount -a
mount: unknown filesystem type 'smbfs'
[root@server ~]#
[root@server ~]# mount -t smbfs \\\\192.168.1.150\\D /mnt -o username=vikas,password=vikas27,workgroup=wrkgrp
mount: unknown filesystem type 'smbfs'
[root@server ~]# mount -a
retrying with upper case share name
mount error 6 = No such device or address
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
I have one doubt. The users vik1 and vik2 are for RHCE share definition in my smb.conf (pasted in previous post) and not of my window box. Do I need to create another share definition for the window box with valid some valid users (like vik1 & vik2) ? Forgive my ignorance.
I was thinking that if I am able to mount it through mount command, I should be able to mount through fstab too.
[root@server ~]# mount -a
retrying with upper case share name
mount error 6 = No such device or address
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
Don't know if you've tried something if you don't say it. And again, re-read the page. The syntax you're using is wrong, and the link tells you explicitly how to set up a credentials file, and how to call it in fstab.
Quote:
I have one doubt. The users vik1 and vik2 are for RHCE share definition in my smb.conf (pasted in previous post) and not of my window box. Do I need to create another share definition for the window box with valid some valid users (like vik1 & vik2) ? Forgive my ignorance.
I was thinking that if I am able to mount it through mount command, I should be able to mount through fstab too.
The words "doubt" and "question" mean different things. And no, you don't, and if you're just mounting a shared Windows resource, Samba doesn't enter into it. You're mounting a shared drive, no different from mounting an NFS or other network resource.
Finally, I got it working. It was a small silly mistake.
I am writing my scenario again, it will be useful for others.
This is my Windows XP Box details:- IP : 192.168.1.150 Computer Name : testwinbox Computer Username : vikas Computer Password : vikas27 Workgroup: wrkgrp Shared Drives: D and E
My Samba Server (RHEL 5.4) details:- IP : 192.168.1.100 Hostname : server.test.com workgroup : wrkgrp (also mentioned in /etc/samba/smb.conf)
Now, I am can mount Windows shared drives (D & E) through command line.
Code:
[root@server ~]# mount -t cifs \\\\192.168.1.150\\E /E -o username=vikas,password=vikas27
[root@server ~]# mount -t cifs \\\\192.168.1.150\\D /D -o username=vikas,password=vikas27
[root@server ~]#
[root@server ~]# df -HTP /D /E
Filesystem Type Size Used Avail Use% Mounted on
//192.168.1.150/D cifs 2.1G 14M 2.1G 1% /D
//192.168.1.150/E cifs 3.7G 46k 3.7G 1% /E
To mount Windows shared drives (D & E) through /etc/fstab, I can use any of the below syntax
[root@server ~]# cat /etc/samba/smb.conf
[global]
workgroup = wrkgrp
server string = Samba Server Version %v
#netbios name = testwinbox
interfaces = lo eth0
hosts allow = 127. 192.168.1.
# logs split per machine
log file = /var/log/samba/%m.log
# max 50KB per log file, then rotate
max log size = 50
security = user
passdb backend = tdbsam
[RHCE]
comment = Hello This is SAMBA
path = /myshare
public = yes
writable = yes
browseable = yes
available = yes
printable = no
write list = @staff, vikas, vicky
valid users = vik1, vik2
This was my mistake, I was using an extra forward slash before D in first column. The net-id term in the link was confusing me. //192.168.1.150//D /D cifs uid=vik1,credentials=/etc/cifspw,Domain=wrkgrp 0 0
Many thanks TB0ne for your patience and help. I am marking this thread as solved.
Last edited by vikas027; 12-23-2010 at 01:54 AM.
Reason: Left something
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.