Click to See Complete Forum and Search --> : Basic samba question


snipz
03-13-2003, 01:41 PM
Hi all,

I am currently confused about this Samba question right now. Do I need to log in as the same user on a Windows 2000 machine that my Linux machine is on right now?

For example, if I am logged in as the user "test" and my Red Hat 8.0 machine, do I need to be logged in as a user named "test" in my Windows 2000 machine also? And what about the passwords? Do they need to be the same also?

Thanks!

Magueta
03-13-2003, 02:16 PM
Yes, you have to be logged in as a user that has access to the Samba share. The passwords have to be the same too. Don't forget to add any user that will be accessing the share to Samba using smbpasswd -a [username] and it'll prompt you for the password afterwards.

Joe

cowanrl
03-13-2003, 05:59 PM
I just want to add something to what Magueta said. The user that you log in to Samba with from your Windows machine has to have both a Linux and a Samba account on the Linux machine.
However, if the Linux machine is logged in as user root or test, you don't need to be logged in as that user on the Windows machine. You can log in from the Windows machine as user snipz as long as snipz has the proper Linux and Samba account.
What will normally happen once you get Samba configured to your liking, there will be no user logged in to the Linux machine most of the time. It will just sit there serving up files and printers with no user logged in.

leonpmu
03-14-2003, 01:43 AM
Sorry, but, are you waning to access a share on a windows system or a share on your linux system?

In both cases you will need to supply a username and password for a user that is existing on that system. For example I am one of the sysadmins for a large group of companies, so, to access the shares on our file server I log in as the administrator on that server and I get access to the system.


I hope that clears up the issues for you.

L

snipz
03-15-2003, 01:21 AM
Ahh...I am still having difficulties getting Samba up and going.

Right now, it seems that the Network Neighborhood in Windows 20000 is seeing my Linux machine, with the computer name of "Linux", which I don't know how it got that from because I don't even have that name in my /etc/hosts file for my Linux box.

When I try to connect to the Red Hat 8 Linux box from Windows, I get a "Host not found error". When I try connecting to Windows 2000 from my Linux box, I get a "(Operation already in progress)" error.

Now the biggest problem that I am seeing is that Samba isn't even seeing my Windows box. When I try connecting to my Windows Box via my Windows client, I get a "added interface ip=192.168.0.101 bcast=192.168.0.255 nmask=255.255.255.0"


Now, 192.168.0.101 isn't even the IP for my Windows box (For Windows, it is 192.168.0.100" and it is actually the IP for my Linux box, so I don't know what is going on there.

This is currently what my basic /etc/hosts file looks like:


# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.0.101 king
192.168.0.100 queen

This is what my Samba configuration file looks like:


[global]
workgroup=WORKGROUP
encrypt passwords=yes
netbios name=Linux
[test]
comment=for testing only
path=/home/shared
read only=no
guest ok=yes
encrypt password=yes

If anyone can provide me with some help, it will be GREATLY appreciated!

***EDIT***
Now I am getting this:

added interface ip=192.168.0.101 bcast=192.168.0.255 nmask=255.255.255.0
Got a positive name query response from 192.168.0.100 ( 192.168.0.100 )
timeout connecting to 192.168.0.100:139
Error connecting to 192.168.0.100 (Operation already in progress)
Connection to Win2kmachine failed

homey
03-15-2003, 03:37 AM
Check these notes to see if it helps.....

When using the VI editor, press the insert key to add information. Press the escape key when done editing. To save the changes and exit type :wq!

Modify the hosts, HOSTNAME and network files. My Linux computer is called BARNEY, the user is FRED and the workgroup is called WORKGROUP.

type vi /etc/hosts
press the insert key and go to the next available line
127.0.0.1 localhost.localdomain localhost
192.168.1.2 barney.workgroup barney
192.168.1.3 machine2.workgroup machine2
192.168.1.1 machine3.workgroup machine3
press the escape key
:wq!

type vi /etc/HOSTNAME
press the insert key and go to the next available line
barney.workgroup
press the escape key
:wq!


type vi /etc/sysconfig/network
press the insert key and go to the next available line
NETWORK=yes
HOSTNAME=barney.workgroup
GATEWAY=192.168.1.1
press the escape key
:wq!


At the command promt type the following to add a linux user...
groupadd workgroup
adduser fred –g workgroup
passwd fred (when prompted, add the password )


Now we can setup the Samba part of networking

1. vi /etc/samba/smbusers
press the insert key and go to next available line
#Unix_name = SMB_name1 SMB_name2
root = administrator admin
nobody = guest pcguest smbguest
fred = fred
press the escape key
:wq!

Note: The user fred needs to exist as a windows user, a linux user and a smb user.

2. cd /etc/samba
At the command prompt, type: smbpasswd –a fred
(when prompted, add the password )

3. vi /etc/samba/smb.conf
press the insert key and go to next available line

Here are some of the important areas of this file which you can change to suit your needs.

workgroup = WORKGROUP
netbios name = BARNEY
printcap name = lpstat
load printers = yes
printing = cups
hosts allow = 192.168.1. 192.168.2. 127.
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
username map = /etc/samba/smbusers
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
local master = yes
os level = 33
preferred master = yes


make other changes as needed
press the escape key
:wq!


Don't forget to restart samba with the command: service smb restart

Magueta
03-15-2003, 09:03 AM
Why are you appending the workgroup to the hostname? Also, why have you added the samba user to a group with the same name as the workgroup?

Joe

cowanrl
03-15-2003, 10:10 AM
added interface ip=192.168.0.101 bcast=192.168.0.255 nmask=255.255.255.0
Got a positive name query response from 192.168.0.100 ( 192.168.0.100 )
timeout connecting to 192.168.0.100:139
Error connecting to 192.168.0.100 (Operation already in progress)
Connection to Win2kmachine failed


From the looks of that, you may have a firewall problem. The positive name query response would be the result of a broadcast. That's the main means the Samba client will use to locate the Windows machine. However, when it tries to establish a TCP session with it(via port 139), it fails.

As root, execute this to temporarily disable your firewall to test it:

iptables -F

Then try to connect.

Your Windows machines are seeing your Samba server as "Linux" because of the line "netbios name = linux" in your smb.conf file. If that line isn't present, then Samba will default to the hostname of the Linux server as the NetBIOS name.
In no way does what is in the /etc/hosts file determine what the hostname of the Linux server is. In most distros, it is either set in /etc/sysconfig/network or in /etc/hostname as homey shows. It can also be set via DHCP.

You should not need to use the /etc/hosts file for name resolution in Samba. As long as all of your computers are on the same IP subnet, they will uses broadcasts for name resolution.

Since you have guest OK = yes in the share definition, then anyone should be able to access the share. However, to be able to write to the share as a guest, you need to be sure the directory permissions on /home/shared give at least read and write permissions to "all others". As root, execute:

chmod 777 /home/shared

to be sure the permissions are there.

snipz
03-15-2003, 02:31 PM
Hi,
I don't even think I have IPTABLES installed. When I try to execute:

[root@king 888]# iptables -F
I get:
bash: iptables: command not found

Just wondering, can the router configuration also play a role in this?

cowanrl
03-15-2003, 04:55 PM
You may want to try the complete path for the command. Try as root:

/sbin/iptables -F

I'm not sure how you got to user root but if you just executed su, the /sbin directory shouldn't be in your path. You'll need to include it in the command.

Since both of the machines are on the same IP subnet, the packets should never go through a router. It shouldn't be an issue.

Magueta
03-15-2003, 07:53 PM
I think the default for RedHat 8 is ipchains. Try the same command with ipchains -F.

Joe

snipz
03-15-2003, 10:31 PM
Thanks all for the help! I actually got Windows 2000 accessing the Red Hat box with no problems. There was a firewall issue with Zone Alarm I believe and with IPTables.

Now I have to get my Linux box working with the Windows box.

Thanks again all..you guys have been a MAJOR help!

Ludootje
03-16-2003, 07:00 AM
Originally posted by Magueta
Yes, you have to be logged in as a user that has access to the Samba share. The passwords have to be the same too. Don't forget to add any user that will be accessing the share to Samba using smbpasswd -a [username] and it'll prompt you for the password afterwards.

Joe
uhm, no.
if I'm logged in as 'foobar' on w2k using password 'blah', I can log in on my libranet just fine as user 'netwerk' and password 'password'.
If I want to access a share on \\Libranet, it simply prompts me for a username and a password. what you're saying is incorrect.

Ludootje
03-16-2003, 07:06 AM
Originally posted by snipz
Now I have to get my Linux box working with the Windows box.
try out LinNeighborhood (watch the caps) or gnomba or komba for a GUI things to login from your GNU/Linux box to your windows. to do it from the CLI, use smbmount.
an example:

smbmount //EXTERNAL-W2K/shared-dir /mnt/path/where/w2k-dir/should/be/mounted -o "username=USERNAME_FOR_W2K,workgroup=W2K_WORKGROUP, password=PASSWORD_COMES_HERE"

afterwards you just 'cd' to the dir where you mounted it.
unmount the share using 'umount /mnt/path/where/...'
also, if you use konqueror, you can use smb:// instead of http:// or file://