LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-10-2007, 11:44 AM   #1
QianChen
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Rep: Reputation: 0
How to set smb.conf if I only need see window machine from linux side


Hello, all,

I have a linux server(RedHat9) and a windows machine(Windows XP). I want to use samba to view the windows machine on the linux side, as if the windows machine was a part of the linux machine.

I don't need the windows machine access the linux machine, I mean, there is no folder shared on the linux machine. I only need there is a shared folder or hard disc on the windows machine so I can access it from the linux machine.

The samba has been already installed on the linux machine, and its version is 3.0.6-2.3E.

I want to know that before I smbmount the //windowsmachine/c, what should I do? How to configure the smb.cong?

Another question is, I need only one user on my linux server, say, "flulims" to access the windows machine, how could I set it?

Any advice is highly appreciated!

Qian
 
Old 01-10-2007, 12:11 PM   #2
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
smb.conf is really for samba servers, which is not what you have. For smbmount, I don't think you need to configure anything, just put the username/password and maybe workgroup name in the smbmount command. You may want to put the workgroup/domain name in the smb.conf file, but you don't need to.

Also, that OS version is long past being supported. Samba is up to version 3.0.24 or something like that. 3.0.6 is old. You will want the most current version you can get a hold of.

To restrict the access on the linux box, you can mount the samba share within that users home directory, and set the permissions so no other users can see his home. The share permissions are controlled by the computer sharing them, not the mounter, so you have to hide the mount within files that you do have control over.

Peace,
JimBass
 
Old 01-10-2007, 02:05 PM   #3
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
You can access a windows share as a regular user. But first you need to adjust your windows firewall settings to allow your linux box to connect to it.

Connecting to windows from linux:
Example: lets say your windows box Ip is 192.168.1.105

At the prompt type this
smbclient -L //192.168.1.105

Enter any password, if any.

This will show all the shares available on windows. Now let say you want to access your music folder from share list. You type this at the prompt.

smbclient //192.168.1.105/music and press enter. Enter any password, if any.

You will get a prompt like this
smb: \>

Now you add or get files from this share by using smb commands like put, get, mput and mget. To see a list of commands type help or help commandname.

An easier way is to mount it and view it from your file manager. As root, type smbmount //192.168.1.105/music /mnt/smbfs

the /mnt/smbfs could be any mount point. This is an example only.

Now open your file manager and enter in the url
/mnt/smbfs

Now to can read, copy or write depending on the permissions.

Good luck

Last edited by dv502; 01-10-2007 at 02:08 PM.
 
Old 01-11-2007, 09:12 AM   #4
QianChen
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
Thank you for your replies.

I still have 3 questions:
1) My windows box is in a DOMAIN whose name is OMRF, do I need to change my smb.conf and set the workgroup as "OMRF"?

2)[root@flulinux01 tmp]# smbclient -L //windows box ip
I just push enter when the "password" appears, and it shows all our LAN.
I don't know which password should I input if I need.

3)[root@flulinux01 tmp] #smbclient -L //windows box ip/my folder
if I input my password under my account of the windows box, it says:
session setup failed: NT_STATUS_LOGON_FAILURE

if I input enter as the password, it says:
Anonymous login successful
Domain=[OMRF] OS=[Windows Server 2003 R2 3790 Service Pack 1] Server=[Windows Server 2003 R2 5.2]
tree connect failed: NT_STATUS_ACCESS_DENIED

Why I can not see all the shared files in //windows box ip/my folder?

Qian
 
Old 01-11-2007, 09:21 AM   #5
QianChen
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
Sorry, I made a silly mistake.

[root@flulinux01 tmp]# smbclient //windows box ip/my folder -U my account
password:mypassword
and it shows
smb: \>

Thank you very much!
 
Old 01-11-2007, 10:29 AM   #6
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 23, 24, RHL 5.2
Posts: 560

Rep: Reputation: 56
Using smbclient gets you an ftp like interface to your windows share. Using smbmount or mount -t smbfs will attach your windows share to a mount point in Linux. This makes it much easier to work with in Linux. smbclient is used if you just want to perform a simple operation like transfer a single file and be done.

Bill
 
Old 01-11-2007, 10:35 AM   #7
QianChen
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
Yes, I still need to mount my windows share. I am trying....
 
Old 01-11-2007, 11:37 AM   #8
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 23, 24, RHL 5.2
Posts: 560

Rep: Reputation: 56
What happened when you used dv502's instructions? The second part of his instructions shows how to use smbmount.

Bill
 
Old 01-11-2007, 11:39 AM   #9
QianChen
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
I have tried these lines:

[root@flulinux01 /]# mount -t smbfs //windowsboxip/myfolder /home/flulims/ -o uid=flulims, gid=flulims
It failed

I then tried:
[root$flulinux01 /]#smbmount //windowsboxip/myfolder /home/flulims/ -o uid=flulims, gid=flulims
It prompts the password:
I input enter, and it says:
Anonymous login successful
5098: tree connect failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed

I then tried:
[root$flulinux01 /]#smbmount //windowsboxip/myfolder /home/flulims/ -o uid=flulims, gid=flulims -U myaccount on windows box
It prompts the password:
I input my password of the account on windows box, and it says:
5119: session setup failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed

What's wrong with the mount?

I want to mount the windows share only to one user in the linux box, say, flulims. How could I do next?

Last edited by QianChen; 01-11-2007 at 03:43 PM.
 
Old 01-11-2007, 01:56 PM   #10
QianChen
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
I tried again.

[root@flulinux01 /]# smbmount //windows box ip/my folder /home/flulims/ -o username='my account on windows box', uid=flulims, gid=flulims

This time it worked, but the problem is I can only see the windows share under /home/flulims. I can not find old folders.

Who can help me?
 
Old 01-11-2007, 02:04 PM   #11
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
You can't mount on a active folder. The mount point has to be unuse. You could create a mount point within your home directory. For example, create a directory called share from your home directory. Now type the command
with the share folder added:

smbmount //windows box ip/my folder /home/flulims/share -o username='my account on windows box', uid=flulims, gid=flulims

This will mount the windows's share folder in the /home/flulims/share directory.

As root, you can mount anywhere in the file system. As long the folder is empty or unuse. These folders act as place holders for mounting devices.

Last edited by dv502; 01-11-2007 at 02:58 PM.
 
Old 01-11-2007, 03:31 PM   #12
QianChen
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
Yes, it worked! Thank you!

I mkdir a new folder "share" under /home/flulims/ and mount the //windows box ip/my folder here.

But the owner of the files under/home/flulims/share is still root.

I added one line like this in the /etc/fstab:

//windows box ip/my folder /home/flulims/share smbfs uid=flulims,gid=flulims,username='my account on windows box' 0 0

I hope the linux machine can mount the windows share automatically at boot. To avoid input my password when it reboot, I have to write my password as an option in the /etc/fstab.Is it all right?
I think it is unsafe.....

Last edited by QianChen; 01-11-2007 at 03:43 PM.
 
Old 01-11-2007, 04:01 PM   #13
QianChen
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
when I type
#mount -a
it prompts password:
I entered my password, and the system says:
12068: session setup failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed

It seems that the line
//windows box ip/my folder /home/flulims/share smbfs uid=flulims,gid=flulims,username='my account on windows box' 0 0
has some problems.....
 
Old 01-11-2007, 05:29 PM   #14
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
Try this. We will put your windows user name
and password in a secret file. cd /etc and press enter. Use any text editor to create the file. For example, we will call our file
mywin. Add these two lines to the mywin file.
username = username
password = password

Replace the username and password with the proper values of your windows box.

Save and exit.

chmod 600 mywin

This will prevent anyone from reading your secret file.

Next edit the /etc/fstab

Add this to the end

//windows box ip/my folder home/flulims/share smbfs credentials=/etc/mywin,uid=1000,gid=100,auto 0 0

Save and exit.

Note: Replace uid=1000 with your user id number and gid=100 with your group id number. To find out your id, open a terminal window
and type id and press enter.


The credentials will read the username and password of the window's share from the /etc/mywin file. This is safer
because your username and password is hidden from prying eyes.

The uid and gid will allow you to read and write because it assigns you as the owner, auto will mount on boot. If your windows machine is not on all the time, use noauto instead of auto. If you use noauto, you can mount it anytime by typing at the prompt as root:

mount home/flulims/share and press enter.

Note: This is all you need, the mount command will read the
mount options for this mount point from the /etc/fstab file.

To test, cd to the share directory and create a folder. If
the folder appears, then you can add or delete files.

BTW, make sure your windows box is on.

Let me know if this work.

Last edited by dv502; 01-12-2007 at 12:24 AM.
 
Old 01-12-2007, 10:12 AM   #15
QianChen
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
dv502, you are so cool!
Yes, they work very well!
And all the files are belong to flulims now! And nobody can peek my password!

Thank you, dv502. I learned much from you!

Thank you, JimBass! Thank you, wmacowski! Thank you for your advice, during my trying, I learned new things.

Thank you all!

Qian
 
  


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
Samba in Debian, smb.conf: smb passwd file = ?????????? henrnorl Linux - Software 1 10-06-2006 09:43 AM
How to set mouse sensitivity in xorg.conf, not window manager lasindi Slackware 8 03-19-2006 05:16 PM
How to Transfer files between Linux machine and Window Machine rktech83 Linux - Networking 7 03-14-2006 03:10 AM
linux as a member of NT domain+smb.conf pc_copat Linux - Networking 4 07-30-2004 08:33 AM
Using SMB to copy files from one linux machine to second linux machine. coppersky Linux - Networking 9 06-24-2003 12:07 PM


All times are GMT -5. The time now is 12:11 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration