9

I have three shared folders in my local home directory- that is to say, on my Ubuntu desktop's /home/me/. All were set up using "Sharing Options" in Nautilus' right-click menu. The standard "Music" and "Videos" folders are configured identically: the "Guest Access" box is checked, but the "Allow others to create and delete" is not. The third folder, called "shared", is configured to not allow Guest access but to allow others to modify files. I have not altered /etc/samba/smb.conf by hand, I have only used Sharing Options to create and modify these so-called "shares".

My roommates have two Windows 7 computers and one Ubuntu Netbook Remix netbook. I have the aforementioned desktop machine and laptop running 10.04. None of these machines can access any of the shares. Attempts to access the Guest shares result in the message

\\machine\directory is not accessible. The network name could not be found.

This is the error message generated by a VM running Windows 2000. The other Windows machines generate a similar error. The Ubuntu laptop gives the error Unable to mount location: Failed to mount Windows share. Hurrah, once again, for informative error messages. That really helps a lot.

When attempting to browse the folder called "shared" from the laptop, I'm confronted with a password dialog. This behavior is the same will all machines I've tried in the situation. On entering my username and password for the account to which the shares belong, the password dialog briefly disappears and is replaced with an identical dialog. No error message, useful or not, appears.

When attempting to browse this folder with the VM, the outcome is the same except that the password dialog helpfully states "incorrect username or password". My assumption is that the username and password in question is that of the user which owns the shares. I have tried all other username and password combinations available in this context and the outcome is the same.

I would like to be able to share files. Sharing them with Windows machines is a nice feature, or would be if it was available. Really I consider sharing files between two machines with the same version of the same operating system kind of a minimum condition for network usability.

Samba last functioned reliably for me more than ten years ago. I have attempted to use it on and off since then with only intermittent success.

Oh, and "Personal File Sharing" from the Preferences menu does not result in an entry in Places → Network → my-server. In fact, the old entry "MY-SERVER" goes away and is replaced by "koanhead's public files on my-server", which when I attempt to open it from the laptop gives a "DBus.Error.NoReply: Message did not receive a reply."

I know I come here and gripe about Ubuntu a lot, but on the other hand I spend literally hours every day trying to fix things in Ubuntu. It's a good system which aspires to greatness, which is why things like this either

  1. Need to work; or

  2. Be adequately documented.

Ideally both would be the case. Anyway, rant over. Hopefully someone will have some insight on this issue. Thanks all who bother to read this wall o'text for your time.

6
  • 1
    This really isn't a good way to fix the problem, but it's a workaround. As long as /etc/samba/smb.conf has map to guest = bad user in the global section and the share has guest ok = yes then if you put in an incorrect username and password (but not blank, just put junk in both fields), things seem to work. I know it's ugly, and I hope someone's got a better answer, so I can fix my setup as well.
    – Jeremy
    Nov 17, 2010 at 3:35
  • 1
    have you thought about use scp at all? put winscp on the windows machines, and running ssh server on your machine. Very simple to setup and administer. Windows file sharing protocols should be avoided at all costs, they dont even work between windows machines very well. I gave up on samba a long time ago. Nov 18, 2010 at 1:09
  • @Jeremy, thank you for the suggestion, I will try it within the next two days and post results here. @user5883, yes, I routinely use sshfs and occasionally scp- but I can't give up on Samba since Ubuntu has adopted it as the "official" file-sharing method and I need to be able to help others with it.
    – koanhead
    Nov 20, 2010 at 9:06
  • @Jeremy, 'map to guest = bad user' was already present in the global section of smb.conf. Adding guest ok = yes has had no discernible effect.
    – koanhead
    Nov 21, 2010 at 21:47
  • 2
    I have awarded the bounty for this answer, not because Samba is now working correctly but because I didn't want to let it expire. Filesharing in Ubuntu is still hopelessly broken as far as I can tell; it has never worked for me since 2006. Samba has only ever worked satisfactorily under Caldera OpenLinux (back in 1999) and Fedora Core 2. In both cases it took several days worth of study, trial and error. My point in posting this question was not that I need Samba to work, but that Ubuntu needs for it to work. This is a deal-breaker for Bug #1, and renders me unable to recommend Ubuntu.
    – koanhead
    Nov 21, 2010 at 22:00

9 Answers 9

8
+100

I'm thinking he doesn't have any samba users.

sudo smbpasswd -a <username>  
gksu gedit /etc/samba/smbusers  
6
  • 1
    this is something that used to throw me...not integrating samba users and system users, but there is a reason. Nov 18, 2010 at 15:23
  • From the smbpasswd man page: "In addition, the smbpasswd command is only useful if Samba has been set up to use encrypted passwords." I have not set up samba to do so manually and I don't know whether Ubuntu sets it up that way by default. Also, the smbpasswd man page makes no reference to smbusers. It intimates that the 'smbpasswd -a' command is sufficient to add a user, but then why does the smbusers file exist? Why would this even be relevant for share-level authentication? The shares are supposed to be globally readable without a password. Why is Samba usable only for Samba experts?
    – koanhead
    Nov 21, 2010 at 21:33
  • I added a user via 'smbpasswd -a' and restarted smbd with no discernible immediate effect. After making and rolling back some of the changes to smb.conf noted above, with associated smbd restarts, now the one folder named 'shared' is accessible from the laptop via the password I set up. So user-level access is now working, but not share-level access, which is what I actually wanted. User-level access is not very useful to me, since I use sshfs for that, but your answer is the most nearly correct one (the only one that effected any positive change) so I will award the bounty to you.
    – koanhead
    Nov 21, 2010 at 21:53
  • I appreciate the check...and understand the frustration. The use of users to provide share level permissions was something I stumbled upon a LONG time ago(I even forget the circumstances, but I felt a lot like you do now). As a workaround, used users and mapped a drive with some sort of "authenticate as" option in the drive mounting. It isn't true share level permissions, but it got me a free implementation that sort of worked as desired. Nov 22, 2010 at 2:58
  • I did that. Didnt help. BTW theres no such file gksu gedit /etc/samba/smbusers so i saved it so its new empty. Whats use of that? How this answer is accepted? It isnt working.
    – Kangarooo
    Jan 13, 2013 at 4:49
3

This is not an answer, but more like a comment, since I don't seem to have the privilege to comment yet. I'm not surprised that your roommate uses Windows 7. I sometimes have trouble sharing files between Windows XP and Windows 7.

I used to work on an Windows XP computer with Ubuntu running in VMware, and transfer files through sharing via Samba. When I tried the same setup with Windows 7, no joy.

It seems like there's something that's changed in Windows 7. So unless you are having issues sharing with an Windows XP, I wouldn't exactly say Samba was more reliable 10 years ago.

reference here and/or try to get newer versions of Samba

http://wiki.samba.org/index.php/Windows7

3
  • 1
    Thanks for the response, and I have suspected myself that Windows 7 might be contributing to the problem. However, I also can't connect from another computer running the same OS as the server (Ubuntu 10.04) nor the local Win2k VM. Unfortunately there isn't an XP machine nearby with which I could test this. My point in the extended rant was that in Ubuntu, Samba should Just Work(tm) since it's the 'official' file sharing method. Having to hack on things to make them work is fine in Arch or even Fedora, but not Ubuntu. Btw, when I want to actually use remote files I use sshfs.
    – koanhead
    Nov 9, 2010 at 15:33
  • It can't even connect to another Ubuntu machine? can your Ubuntu 10.04 can see the other computer perfectly? I know you've probably checked this, but are these computers in the same GROUP?
    – hansioux
    Nov 10, 2010 at 1:56
  • yes, the two Ubuntu computers show up in each other's Places->Network. In fact all the computers involved can see one another, but none can access the shares hosted by the Ubuntu box and neither Ubuntu box can access any shares (I don't have an account on the Windows machine, so I don't expect that to work anyway.) Initially the two Ubuntu computers were part of a seperate workgroup, but I have changed this so that all computers on the local network are on 'WORKGROUP'.
    – koanhead
    Nov 10, 2010 at 23:07
3

I usually do it by editing the conf file. I did this: sudo nano /etc/samba/smb.conf, and added this at the end of the file.

[Shared]
     comment = My Files
     path = /home/me
     read only = yes
     write list = koanhead
     guest ok = yes

At 'write list' mention your system username, so that you only have write permission. On the windows machine type this at run: \\ip-of-the-samba-pc\shared. On ubuntu machine open file browser and type this at the location bar smb://ip-of-the-samba-pc/shared

2
  • Thanks for the suggestion, I will try it within the next two days and report back.
    – koanhead
    Nov 20, 2010 at 9:08
  • Adding the cited text to /etc/samba/smb.conf causes all the shares to disappear from the Nautilus "Windows shares on my-server" window.
    – koanhead
    Nov 21, 2010 at 21:23
3

You say you were able to make user-level access work. That sounds to me like it is merely your samba configuration that is wrong. In the olden days, I'd have said clear out the samba.conf, and make a simple one that suits your needs, a proper samba.conf doesn't need to be more than 10 lines, maybe.

Anyways, since then a simpler solution has emerged: install system-config-samba

sudo apt-get install system-config-samba

Before you begin you might like to reset the samba.conf to it's original state. To make sure no "hidden" syntax errors have snuck their way in during all the troubleshooting

The control panel is quite simple:

  • click the '+' sign
  • select directory
  • make visible (and writable?)
  • go to the 'Access' tab
  • choose 'Allow access to anyone'

An alternate (and slightly more proper) way of doing it:

  • create a *nix user named: guest (or whatever you like)
    • for security reasons make sure "guest" has /bin/false as login shell (unless you want the guest to be able to login through ssh etc. as well)
  • in the "Preferences" menu: select "Samba users"
  • make sure "guest" is on the list: if isn't create it.

then

  • in the "Preferences" menu: select "Server settings"
  • On the "Security" tab: by "Guest Account", select 'guest'

Now anyone who tries to log in anonymously will be assigned to the user 'guest', and thus will have whatever rights 'guest' has.

  • now create the share as described before, except instead of choosing "Allow access to everyone", merely select 'guest'.

make sure the *nix user 'guest' has sufficient rights to read and/or write in the shared folder.

Good Luck!

/B2S

2

In order for new Windows systems to access the current/old Ubuntu Samba shares, you need to enable password encryption (encrypt passwords = yes in the smb.conf).

The thing that has changed in Windows 7 is that they have put in a security requirement for Samba passwords to be encrypted. The same applies to XP if you have KB2536276 installed.

I went round & round with this issue on our network at work until I found the solution of changing that "no" to "yes" on encrypted passwords. This still works for a wide-open share that everyone has read/write access to with no password - even though you have no password, it still must tell Windows that the nonexistent password is encrypted for Windows to let you on there.

This answer is assuming you have everything else configured for Samba to work correctly, such as users (or the lack thereof) and permissions set.

For the open/easy share with no passwords etc, make sure you have security = share, guest account = nobody, and/or map to guest = Bad User in the conf.

1

I'm sorry to tell this, but I had same problem, my computer were undetectable in LAN, after that I reinstalled the system(clear reinstall with full formatting) and everything worked fine.

1

If using Windows 7, you may need to change your registry settings:

See the Samba wiki for more information, or simply execute the file Win7_SambaDomainMember.reg

If using Ubuntu 11.10, make sure that you have python-glade2 installed

sudo apt-get install python-glade2
1

An easy solution to share your home folder is to uncomment the lines in the [homes] section of /etc/samba/smb.conf (remove the ";")

0

I believe should check wether or not you have firewall/iptables rules preventing it. If you are not sure easiest way is (and also manage iptables in future) to install ufw and

sudo ufw allow samba
sudo ufw enable
1
  • ufw is already configured to allow samba.
    – koanhead
    Nov 20, 2010 at 9:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .