Linux - Server This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
12-15-2010, 11:37 AM
|
#1
|
Senior Member
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305
Rep:
|
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.
|
|
|
12-15-2010, 01:43 PM
|
#2
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,259
|
Quote:
Originally Posted by vikas027
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.
|
|
|
12-15-2010, 10:47 PM
|
#3
|
Senior Member
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305
Original Poster
Rep:
|
Quote:
Originally Posted by TB0ne
|
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.
|
|
|
12-16-2010, 08:19 AM
|
#4
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,259
|
Quote:
Originally Posted by vikas027
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.
|
|
|
12-18-2010, 02:51 AM
|
#5
|
Senior Member
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305
Original Poster
Rep:
|
Quote:
Originally Posted by TB0ne
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.
|
|
|
12-18-2010, 12:39 PM
|
#6
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,259
|
Quote:
Originally Posted by vikas027
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.
|
|
|
12-23-2010, 02:52 AM
|
#7
|
Senior Member
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 07:01 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|