LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to set smb.conf if I only need see window machine from linux side (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-set-smb-conf-if-i-only-need-see-window-machine-from-linux-side-518055/)

QianChen 01-10-2007 11:44 AM

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

JimBass 01-10-2007 12:11 PM

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

dv502 01-10-2007 02:05 PM

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

QianChen 01-11-2007 09:12 AM

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

QianChen 01-11-2007 09:21 AM

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!

wmakowski 01-11-2007 10:29 AM

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

QianChen 01-11-2007 10:35 AM

Yes, I still need to mount my windows share. I am trying....

wmakowski 01-11-2007 11:37 AM

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

Bill

QianChen 01-11-2007 11:39 AM

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?

QianChen 01-11-2007 01:56 PM

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?

dv502 01-11-2007 02:04 PM

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.

QianChen 01-11-2007 03:31 PM

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.....

QianChen 01-11-2007 04:01 PM

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.....

dv502 01-11-2007 05:29 PM

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.

QianChen 01-12-2007 10:12 AM

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


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