PDA

View Full Version : Sharing printers and files between Windows and Linux



XMAG
20th November 2007, 11:44 PM
For some time now I have been looking for a way to to this, I have read thousands of tutorials on the web but all of them seem to assume I know 90% of it, so I always get lost during the process, I tried to follow some but had no success.

My computer, the one the printer is connected to, is running Fedora 8 but has also a NTFS partition. My brother's computer is running Windows XP and I wish to print files from there, without having to bring them here with a pen-drive or through the internet. We have a network set-up where we share an internet connection (DSL with a router modem) and each of the computers has it's own IP address within it.

As I know nothing when it comes to linux-windows integration and I have some pretty basic questions:

1) Is it possible to set-up a network like I used to in windows, where each computer can see the other's files in Windows Explorer/Nautilus? Or at least make my Fedora see my brother's files (Windows XP) (I also have an NTFS partition here on my computer, so maybe my brother's computer can see this one?).

2) When sharing my printer (connected to my computer, running Fedora) will it appear as a printer on the printer's folder in my brother's computer, as it did when I used to run XP, or will it be accessible otherwise?

3) Would someone help me through this process or know a nice tutorial I could follow?

Thanks!

glennzo
21st November 2007, 03:52 PM
Install samba. In a terminal as root type yum install samba. Edit /etc/samba/smb.conf. In a terminal still as root type gedit /etc/samba/smb.conf. Change the workgroup name to reflect your Windows workgroup. It probably says WORKGROUP. Change it to whatever your workgroup is. Move down the file to the shares section. There's one for tmp. Uncomment those lines for now. Save the file and restart samba by typing /sbin/service smb restart. Also select System > Administration > Services and check the box next to smb and nmb. Restart nmb while you are in there. Open Network Places on the Windows box. Click View Workgroup Computers. Your Linux box should show up. Click on it's icon and you will be prompted for login credentials. Login as the user you use on the Linux box. Now you should see the tmp folder. Click on it and you should see the files within that folder listed. Once this is working we'll get a printer setup.

Note: Make the tmp section look like this:
[tmp]
Comment = Temporary Folder
path = /tmp
public = yes
writable = yes
browseable = yes

XMAG
21st November 2007, 06:05 PM
I'm not able to login, I put my username and password the same way I do to login to Fedora and it asks for the password again

UPDATE: I was able to see the folders by changing security from user to share

Also there was nothing on "tmp" or anything like that on smb.conf, I added the lines you mentioned just bellow "[printers]" section.

I didn't understand which lines you said to uncomment

anyway, seems to be working

glennzo
21st November 2007, 07:00 PM
Essentially I meant to uncomment any lines in the tmp section. I can be somewhat unclear at times. Anyhow, we've made progress then? You can see the tmp folder and all files within that folder from Windows?

By the way, any time you make a change to smb.conf you need to restart smb and nmb, /sbin/service smb restart and /sbin/service nmb restart.

XMAG
21st November 2007, 07:48 PM
Thanks glennzo, its working for now, but when I set "yes" to everything under [printers] my printer is still not showing on my brother's computer, the only printer showing now is CUPS-PDF (which didn't before) but here I have 3 printers configured, one is CUPS-PDF and the other two are officejet_4200_series and officejet_4200_series_fax from my HP Officejet 4255 All-in-one

I checked all the boxes under Basic Server Configuration on system-config-printer and it is still not showing.

Also, why can't I make a share for my user's home (/home/caio)? It shows on my brother's computer but I'm not able to access it.

Thanks

glennzo
21st November 2007, 08:07 PM
[homes]
comment = Home Directories
browseable = no <--- Change to yes ???
writable = yes

Been a while since I've shared a printer connected to a Linux box.

Do you have this section in smb.conf ???
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes

Restart samba. Then go to the Windows computer and see if you can add a networked printer. As I recall I had to add it as smb://workgroup/hostname:631/printersharename

In my case smb://johnson/mom:631/epson88, johnson being the workgroup and mom, well, the computer was attached to my wife's computer called, what else, mom.

My notes may be somewhat irrelevant to your situation but maybe they will enlighten you so look here (http://www.johnson.homelinux.net/mywiki/Printer_Setup).

XMAG
22nd November 2007, 02:42 AM
my computer's name suddenly changed from caio to localhost, and localhost is not accessible through my brother's computer or mine... I don't know how that happened, maybe it has got something to do with me opening system-config-samba, just to cjech it out, thigs were messed up...

Now when I open a terminal it says [caio@localhost ~] and not [caio@caio ~] as it did before.... how can I change that back??

Thanks

glennzo
22nd November 2007, 02:55 AM
Edit the file /etc/sysconfig/network. Change the hostname to your liking. I believe you will need to reboot for the change to take full effect.

XMAG
22nd November 2007, 04:20 AM
[homes]
comment = Home Directories
browseable = no <--- Change to yes ???
writable = yes
I did change to yes, it prompts me for a password like it did before, it is surely not my root password nor my user's passoword, since none of them will grant me acess and it keeps asking me for a password
Been a while since I've shared a printer connected to a Linux box.

Do you have this section in smb.conf ???
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes

Restart samba. Then go to the Windows computer and see if you can add a networked printer. As I recall I had to add it as smb://workgroup/hostname:631/printersharename

In my case smb://johnson/mom:631/epson88, johnson being the workgroup and mom, well, the computer was attached to my wife's computer called, what else, mom.

My notes may be somewhat irrelevant to your situation but maybe they will enlighten you so look here (http://www.johnson.homelinux.net/mywiki/Printer_Setup).I actually don't have the same you wrote there, i have:

[printers]
comment = All Printers
path = /var/spool/samba
browseable = yes
guest ok = yes
writable = yes
printable = yes

still nothing is showing... hostname would be my computer's name on the network right? How can I find the port to which the printer is connected?

Thanks!

glennzo
22nd November 2007, 10:24 AM
Hostname, in this case, is the name of the computer that the printer is attached to. Here it's mom. I print from my laptop to epsonc88 attached to mom, so it's smb://johnson/mom:631/epsonc88. Of course, this is the reverse of what you are doing. I'm printing to a Windows printer from a Linux conputer. The printer IS shared, right?

XMAG
22nd November 2007, 04:44 PM
Yes it is set to share.

I seen in a lot of places people saying that I need to create a "fake" account both in windows and linux to make the password thing work... Do I?

So far I only managed to share the /tmp folder on my computer, but I'm able to acess my brother's folders that are set to share... Still no printer is showing...

How can I setup this?

glennzo
22nd November 2007, 04:57 PM
Yes it is set to share.

I seen in a lot of places people saying that I need to create a "fake" account both in windows and linux to make the password thing work... Do I?

So far I only managed to share the /tmp folder on my computer, but I'm able to acess my brother's folders that are set to share... Still no printer is showing...

How can I setup this?
On your Linux box, create a samba user, that is, take the name of the user on the Windows box, the one logged on and trying to access the Linux box, and make a user for him. Let's say that user bob is logged on to the Windows box and is trying to access the Linux box. No go. Go to the Linux box and in a terminal type smbpasswd -a bob. When it asks for a password, twice, just press enter.

smbpasswd -a bob
enter
enter
enter
Restart samba
/sbin/service smb restart
Browse the Linux network as bob.
Now try adding a printer.

XMAG
22nd November 2007, 05:32 PM
ok, I added a user to my linux machine called fabio (the user in my brothers computer) and I set his password as blank in a terminal as you said, still I'm not able to access home share though the network.

The [homes] share is actually giving me acess to the "/" directory, this is how it looks now:

[homes]
comment = Home Directories
browseable = yes
writable = yes
valid users = %S fabio caio
; valid users = MYDOMAIN\%S

Update: I haven't changed anything since then and now the [homes] share is not acessible through my brother's computer anymore... this thing is making me crazy...

The problem is that the only way I managed to share my actual home folder (/home/caio) was to set its pesmissions as read/write to anyone, but then it keeps complaining when I login I cannot have these permissions... Am I not able to share my home folder then? All my stuff is in it...

The only printer showing under the folder "printers and fax devices" is still CUPS-PDF

glennzo
22nd November 2007, 06:02 PM
Have you been restarting samba after each change you make to the smb.conf file?

Yes, printing from Window to Linux makes me insane also. :eek:

XMAG
22nd November 2007, 07:59 PM
yes, after every single change...

bbfuller
22nd November 2007, 09:46 PM
Hello XMAG

I've been doing a bit of experimenting here and I think you may be looking at a limitation that is built into Samba.

I've always used Samba for Linux/Linux communication and Windows/Linux but I've usually had just the one user to worry about. I've found that I need the same user on the Linux box as on the Windows box - I've always assumed with the same password though I've never tried it without - and then made a Samba password for that same user that was once again the same password.

With that in place I have no difficulty for a user on Windows accessing their own home area - or a subset of it - on the Linux box. In some circumstances, giving access to a users configuration files may not be considered a good idea.

What I can't do is give any other user access to someone else's total home area or some subset of it.

Why I think it is an inbuilt limitation is that if I make a directory - called in this case "testsamba" directly off / so that its path name is:

/testsamba

and give it Linux permissions of read and write to everyone and then share it in Samba - and I've only tried this with explicit users not globally yet - then I get full access to it from the remote machines.

XMAG
22nd November 2007, 10:02 PM
sorry man I didn't understand what you meant... you have the same user name and password both in your linux and windows computer? That way you can acess your /home/yourusername folder on the windows computer?

If I understood right the example of /testsamba is exactly what is happening to my /tmp folder, which is free access to anyone in Linux, so there's no problem of sharing it though the network...

Why is there a share called [homes] and its comment is "home directories" by default and thats not actually /home ou /home/yourusername?? What is the purpose of this share?

I found cases on the web where people are complaining their entire home folder is being shared, which is exactly what I want to do, not necessarily the configuration files or the folders starting with a ".", but Documents, Download, Images etc. I guess I could make shares for each of them but then I wouldn't be able to access any files in /home/caio.

Anyone have any ideas why my default printer is not appearing to my brother's computer and CUPS-PDF is?
Thanks

XMAG
22nd November 2007, 10:11 PM
here it is: http://ubuntuforums.org/archive/index.php/t-184433.html

I also tried following this (http://ubuntuforums.org/showthread.php?t=76647and had no success at all.. again, on my brother's computer I typed "caio" as user and the password I set with smbpasswd, which is also the same as my linux user and it says the folder is not accessible... now i can't acess the whole computer so not even /tmp is accessible.

I still cannot understand where the problem is

bbfuller
22nd November 2007, 11:26 PM
As I understood it, you were trying to access folders on your linux box from your windows machines?

Actually, with the passwords and users set up as above my linux box will happily access shares that have been set up on the windows box as well.

/home/yourusername is of course a share on my linux machine.

I've just booted my Sabayon machine and created a share in my home folder there. Always assuming I have the users and passwords set up as specified in my earlier post I can confirm that I am able to access the share from a different user on my Windows box quite unlike the Fedora position.

As far as I can see there is no difference in the two smb.conf files.

It would appear that it is something specific to the way Samba is compiled for Fedora.

I suppose you could always try uninstalling samba and obtaining a vanilla version from the Samba website.

XMAG
23rd November 2007, 12:03 AM
what is a vanilla version?

I believe my problem here is either a wrong configuration or a problem with authentication, since I was never able to access anything using a password, the only way I could access anything through samba was when security was set to "share". I'm under the impression that I can't access a home share with security set as "share" as there would be no login to redirect me to the right home folder (that's why I was going to / instead of /home/caio before)

Anyone knows why I cant get it to work with security set as "user"???

Thanks

bbfuller
23rd November 2007, 12:09 AM
Vanilla= plain

That is something without any options set by the compilers of the program.

XMAG
23rd November 2007, 06:13 AM
I just managed to acess my home/caio folder through my brother's computer, i think the problem was that I was not selecting my user (caio) as the only valid one, I just added a new share with "valid users = caio" parameter and it worked... I just hope it doesn't stop working by itself again!:D

Now all I have left is to make samba view my printer... I believe the problem is that smb itself is not able to see it and not a server setting, as when looking through SWAT the only printer showiing is also cups-pdf... how can I make samba see my printer?

Thanks!

glennzo
23rd November 2007, 12:06 PM
Have you looked here (http://us3.samba.org/samba/) XMAG ? I'm out of suggestions at this point. I remember that when I had a Linux box as a print and backup server that setting up a shared printer was a nightmare, more so because of my lack of experience than anything else, but non the less. I spent a lot of time reading the Samba docs, and eventually got it working. I do remember that for every user that needed access to the printer I had to create an account for them on the Linux box. Then I needed to do the smbpasswd thing for each user. I needed to go to the printer configuration in Linux and set the printer as shared. I also spent a lot of time examining the smbclient -L command which as I recall was very helpful. One more thing. If I remember correctly I needed to add the IP address and hostname of each networked computer (5) to /etc/hosts. That one change seemed to make it easier for the computers to see each other on the network. I stuck with this until I succeeded because I was determined that our home 'server' was going to be running Linux and not Windows. Of course the computer eventually died and now we print to a Windows hosted share because it's just easier and my wife and daughter don't complain to 'tech support' anymore, so I get some peace. I'd like to see you get this working. It can be done. You just need a certain level of determination, and once you get it all sorted you'll sit back satisfied, thinking that in the end it was really pretty easy.