PDA

View Full Version : Connecting to windows network


Inuxlay
2005-02-02, 02:18 PM CST
HI,
I am trying to connect my FC2 box to a windows network to access files on my windows account there. I am a total newb and I don't know how to go about this. Any pointers would be appreciated.
Christine

KeDruff
2005-02-02, 02:36 PM CST
If you want to access a Windows Server, you'll need to set up samba to access that workgroup, at the least. This is the first entry in smb.conf. Make it "students," or whatever the name of your workgroup/domain is. After that, I am sure you'll have to set up smb.conf to login to the WinNT domain, but I have no experience in this.

KD

pparks1
2005-02-02, 02:53 PM CST
Actually, in order to connect a linux box to a Windows file share, you do not need to configure anything at all in Samba. You configure samba (SMB.conf) when you want the Linux box to act like a Windows file server.......e.g., You want to share files on your Linix box for the Windows network.

You have a package natively installed in FC3 (samba-client) which adds support for samba into the mount command.

So, on linux, you could do the following

1. mkdir /mountpoint.
2. mount -t smbfs -o username=user/domain //windows_server/sharename /mountpoint
3. it will then ask you for your password. Enter it here and you should find your files mounted under /mountpoint (created in step 1)

Most of my linux machines are command line only, so I didn't provide any info on how to do this through the GUI. I know it is possible, but give this a try first just to see that it works.

KeDruff
2005-02-02, 02:57 PM CST
Thanks... didn't know that. But, I am correct in that she will have to configure smb.conf if she wants to connect TO her box from elsewhere on the network?

KD

Inuxlay
2005-02-02, 03:09 PM CST
I followed the above steps and got no error messages, however, I was not prompted for a password, and there are no files in the new directory. Also, where should I have created the new directory?

Inuxlay
2005-02-02, 04:13 PM CST
This is the error message i got:

[root@localhost /]# mount -t smbfs -o cslocum/goucher.edu //darwin/users /mountpoint
4357: Connection to darwin failed
SMB connection failed


What does this mean?

KeDruff
2005-02-02, 05:38 PM CST
Your domain is PROBABLY NOT goucher.edu... Your domain is typically something like Students or Faculty or something of the sort. Domain in the above example does not mean the internet domain, it means the NT Domain that is used internally. If you go to a WinNT box and try to logon, it should tell you what the domain is.

KD

PJam26
2005-02-02, 05:40 PM CST
what if it is a windows network in my house, and i just want to share files betwwen the linux box and the windows box...how do i do it, windows XP?

KeDruff
2005-02-02, 08:08 PM CST
If you want to share FROM WinXP to Linux, you should be able to connect to the machine in the following fashion:

1. mkdir /mountpoint.
2. mount -t smbfs //windows_server/sharename /mountpoint


If you want to share from your Linux box to Windows, you need to set up a share using smb.conf. Again, set your workgroup (same as it is in Windows), and then scroll to the bottom where there are examples of how to set up shares.

Once you've set up your share, restart smb and try it out.

KD

olivierv
2005-02-04, 02:36 PM CST
In response to pparks1's comment:
Actually, in order to connect a linux box to a Windows file share, you do not need to configure anything at all in Samba.

I don't think that's correct. KerDuff was correct in pointing out that you need to change the workgroup to match your workgroup OR domain. I've never been able to connect to a share without this being set to reflect either my workgroup (at home) or my ADS Domain (at work). Without this step I've always gotten an error similar (if not the same) as what Inuxlay reported.

I've always used the following command to connect to a share (domain or workgroup) and this is AFTER setting the correct value for WORKGROUP in smb.conf:

mount -t smbfs //winserver/sharename /mnt/wheretomount -o username=yourWindowsUserName

Also, unless you've got smbmnt suid to root (not optimal for the paranoids about security) or an appropriate entry in /etc/fstab, only root can execute the above command.

Having said that, if there is a way around this or if I was missing something- teach me!

Northern
2005-02-04, 03:40 PM CST
I use this command to mount windows shared directories from linux -


mount -t smbfs //winserver/sharename /mnt/wheretomount -o username="yourWindowsUserName",password="myWindowsPassord"

Without touching smb.conf.

To make this easier I added the following line to /etc/auto.misc -

windows -fstype=smbfs,ro,nosuid,username="windowsUsername",password="windowsPassword" ://winserver/sharename


Then -

chkconfig autofs on
service autofs restart


Now if I do 'ls /misc/windows' I see my windows share :)

Hope that helps

willieray
2005-02-04, 03:48 PM CST
I use this command to mount windows shared directories from linux -


mount -t smbfs //winserver/sharename /mnt/wheretomount -o username="yourWindowsUserName",password="myWindowsPassord"

Without touching smb.conf.


not the most secure way to mount if people are around. if you leave off the password switch, it will prompt you and not leave your pw in plain text for all to see. also, auto.misc and fstab are readable by any user. there must be a more secure way using shadow no?

Northern
2005-02-04, 03:55 PM CST
Yep spot on. However it works and its reliable. Most folk dont have passwords on windows boxes anyway so it makes no odds ;)

I just use autofs at work cos we've got a windows machine with downloaded software/patches on it, just makes things easier.

I guess on an internal home network the security factor is not really an issue for most people :)

olivierv
2005-02-07, 04:25 PM CST
I guess on an internal home network the security factor is not really an issue for most people :)
As a security professional, that hurts. A lot.

:)

Northern
2005-02-08, 01:44 AM CST
You a copper then :p

edit oops you said professional :D

Northern
2005-02-08, 02:19 AM CST
Just to add to this. I just 'chmod 600 /etc/auto.misc' and restarted autofs and it still worked fine as a normal user.

No security probs now :)

ucfagls
2005-02-08, 03:55 AM CST
In response to olivierv's comment:
In response to pparks1's comment:
Actually, in order to connect a linux box to a Windows file share, you do not need to configure anything at all in Samba.
I don't think that's correct. KerDuff was correct in pointing out that you need to change the workgroup to match your workgroup OR domain. May be that's something specific to your setup (Windows?). I've never touched my smb.conf but successfully contect to our Windows 2K Server box (though not for much longer I hope...) - which has been placed into a specific workgroup.

This is what I do to connect during a reboot to a windows share:
1) Create a directory in /mnt where you want to mount to
2) Create a file (I called mine smbcred) in your home that contains your username and password for the windows share like this:username = yourusername
password = yourpassword 3) chmod 600 smbcred #so only you can read or write to it
4) Edit your fstab to include a line similar to the following:
//[IPADDRESS]/myshare /mnt/myshare smbfs credentials=/home/you/smbcred,uid=yourlinuxuser,gid=yourlinuxuser 0

Then when you reboot your share will automatically be mounted for you without prompting for passwords etc. Note I needed to use the IP address of the machine not it's Windows Computer name so replace [IPADDRESS] with the relevant IP address for your windows box. The uid and gid should be set to the uid and gid for your user account in linux. You can use the numerical id or the textual user/group name. This will give you full permissions on the mounted directory/files.