LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-15-2010, 11:37 AM   #1
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Question Samba Entry of fstab to mount windows shared folder on Linux machine


Dear All,

I spent all day learning some concepts of Samba which I left while preparing for RHCE.

One of them is how to permanently mount (fstab entry) windows shared folder.

Manually mount command is running fine for me.
Code:
[root@server /]# mount -t cifs \\\\192.168.1.150\\D /mnt -o username=vikas,password=vikas27
[root@server /]# df -kh /mnt
Filesystem            Size  Used Avail Use% Mounted on
//192.168.1.150/D     2.0G   13M  2.0G   1% /mnt
But, either of these lines are not working for /etc/fstab.
Code:
//192.168.1.150//D      /mnt                    cifs    defaults,username=vikas,password=vikas27   0  0
\\\\192.168.1.150\\D    /mnt                    cifs    defaults,username=vikas,password=vikas27 0 0
Hope I am missing a small thing. Please help.
Thanks in advance.
 
Old 12-15-2010, 01:43 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,259

Rep: Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079
Quote:
Originally Posted by vikas027 View Post
Dear All,
I spent all day learning some concepts of Samba which I left while preparing for RHCE.

One of them is how to permanently mount (fstab entry) windows shared folder.

Manually mount command is running fine for me.
Code:
[root@server /]# mount -t cifs \\\\192.168.1.150\\D /mnt -o username=vikas,password=vikas27
[root@server /]# df -kh /mnt
Filesystem            Size  Used Avail Use% Mounted on
//192.168.1.150/D     2.0G   13M  2.0G   1% /mnt
But, either of these lines are not working for /etc/fstab.
Code:
//192.168.1.150//D      /mnt                    cifs    defaults,username=vikas,password=vikas27   0  0
\\\\192.168.1.150\\D    /mnt                    cifs    defaults,username=vikas,password=vikas27 0 0
Hope I am missing a small thing. Please help.
Thanks in advance.
From Google, if you tried to look it up.
Code:
//my.server.name/directory /mnt/point cifs uid=userid,credentials=/etc/cifspw,domain=Domain 0 0
Reference the page here:
http://webscript.princeton.edu/~pug/...Windows_Shares

Also, be aware the options for cifs and smbfs are different.
 
Old 12-15-2010, 10:47 PM   #3
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Original Poster
Rep: Reputation: 107Reputation: 107
Unhappy

Quote:
Originally Posted by TB0ne View Post
From Google, if you tried to look it up.
Code:
//my.server.name/directory /mnt/point cifs uid=userid,credentials=/etc/cifspw,domain=Domain 0 0
Reference the page here:
http://webscript.princeton.edu/~pug/faqwiki/index.php?title=Using_SAMBA/CIFS_to_access_Windows_Shares

Also, be aware the options for cifs and smbfs are different.
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'
When I tried either of these lines in fstab
Code:
//192.168.1.150//D      /winshare               cifs    uid=testwinbox,username=vikas,password=vikas27,Domain=wrkgrp   0  0
or
//192.168.1.150//D      /winshare               cifs    uid=testwinbox,username=vikas,password=vikas27,Domain=wrkgrp   0  0
I got this error
Code:
[root@server ~]# mount -a
bad user name "testwinbox"
As per your link, uid is the name of the windows box.


This is my /etc/samba/smb.conf if in case it is required to further dig into it.
Code:
[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
Thanks for your time.
 
Old 12-16-2010, 08:19 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,259

Rep: Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079
Quote:
Originally Posted by vikas027 View Post
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'
When I tried either of these lines in fstab
Code:
//192.168.1.150//D      /winshare               cifs    uid=testwinbox,username=vikas,password=vikas27,Domain=wrkgrp   0  0
or
//192.168.1.150//D      /winshare               cifs    uid=testwinbox,username=vikas,password=vikas27,Domain=wrkgrp   0  0
I got this error
Code:
[root@server ~]# mount -a
bad user name "testwinbox"
As per your link, uid is the name of the windows box.
Wrong. The UID is "USER ID, and it's clearly identified as such in the link.
 
Old 12-18-2010, 02:51 AM   #5
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Original Poster
Rep: Reputation: 107Reputation: 107
Question

Quote:
Originally Posted by TB0ne View Post
Wrong. The UID is "USER ID, and it's clearly identified as such in the link.
Hi TB0ne,

I had used UID too.

I used the below line in fstab
Code:
//192.168.1.150//D      /winshare               cifs    uid=vik1,username=vikas,password=vikas27,Domain=wrkgrp   0  0
But I am getting this error
Code:
[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.
 
Old 12-18-2010, 12:39 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,259

Rep: Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079
Quote:
Originally Posted by vikas027 View Post
Hi TB0ne,
I had used UID too.

I used the below line in fstab
Code:
//192.168.1.150//D      /winshare               cifs    uid=vik1,username=vikas,password=vikas27,Domain=wrkgrp   0  0
But I am getting this error
Code:
[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.
 
Old 12-23-2010, 02:52 AM   #7
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Original Poster
Rep: Reputation: 107Reputation: 107
Thumbs up Finally, it worked.

Hi TB0ne,

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
Code:
//192.168.1.150/D      /D               cifs    uid=vik1,credentials=/etc/cifspw,Domain=wrkgrp   0  0

OR

//192.168.1.150/E      /E               cifs    uid=abc,username=vikas,password=vikas27,Domain=wrkgrp   0  0

Here, /etc/cifspw contains :-
Code:
[root@server ~]# cat /etc/cifspw
username=vikas
password=vikas27

Again, my smb.conf is as follows.
Code:
[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 02:54 AM. Reason: Left something
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows machine can not see my samba shared folder. mtlhd Linux - Server 13 05-09-2009 10:01 PM
Can't write to a shared folder from Windows XP machine Virtuality Linux - Networking 3 05-31-2007 03:49 AM
Mount shared folder with fstab - need help robertpolson Linux - Networking 21 01-26-2007 06:38 PM
how to access a shared folder on a windows machine learnfast Linux - Newbie 11 03-12-2005 02:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration