24

In Ubuntu Maverick, I've shared some folders using the Nautilus "Sharing Options" GUI.

alt text

I can see them from Windows 7, but when I try to access them (from Windows) it asks for a username and password. No matter what I enter, it won't let me in. How do I configure this to share normally?

Update: I've found that some of the shared folders let me in, but others don't. Of the ones that do, some of their subfolders do, others don't, etc. How can I investigate what's causing this?

When I let the GUI install what it needs, it installs samba and libpam-smbpass. On the machine I am having trouble connecting to, libpam-smbpass is not installed. Could this be the problem?

Seth
  • 59,332
endolith
  • 624

10 Answers10

25

Have you installed Samba? sudo apt-get install samba

If so, then you need to set a Samba password: sudo smbpasswd -a USERNAME. This command will generate a prompt for a password (substitute USERNAME with your username).

Set a folder to share mkdir /home/USERNAME/sharedfolder

Make a backup copy of your smb.conf file: sudo cp /etc/samba/smb.conf ~

Open your smb.conf file: gksu gedit /etc/samba/smb.conf

Add this to the very end of the file:

[sharedfolder]
path = /home/USERNAME/sharedfolder
available = yes
valid users = USERNAME
read only = no
browsable = yes
public = yes
writable = yes

There should be NO spaces between the lines, and there should be a single space both before and after each of the equal signs. Save and exit gedit.

Restart Samba sudo restart smbd

Use this command to check your smb.conf file for syntax errors: sudo testparm

You now should be able to share from your Windows 7 machine.

Edit:

I understand your trying to access your Ubuntu share from Windows 7 and that you want to do so with a GUI interface.

but when I try to access them (from Windows) it asks for a username and password. No matter what I enter, it won't let me in. How do I configure this to share normally?

To do so you must set up a Samba user/password on your Linux machine as I described above. I could recommend a GUI program for Ubuntu to do this, but frankly it's much more complicated and confusing to do it that way. The program is gadmin-samba and it's in the Ubuntu repository. Caution! you can totally bork your config if you misuse this program. Please let us know what steps you've now taken, and which errors you have encountered. Thanks!

bluish
  • 113
JBAlaska
  • 317
7

Open Nautilus again as an ordinary user and modify the share to remove guest access. Type gksudo nautilus, navigate to the shared folder and share it again. Share the folder but do not give guest access. Close nautilus.

Go to your Windows box and access the share and provide the Ubuntu username and password.

Ensure your Ubuntu firewall allows incoming access to Samba ports. Ensure Windows firewall allows outgoing access for the same ports.

BZ1
  • 598
5

I have a ubuntu server with a number of computers and laptops running Windows 7 and found that one laptop would not allow access to files in folders stating "You may not have permission etc". Scoured the internet for 3 days - no luck. Finally decided to ask my son who installed the server and he said that Windows 7 can store passwords to the server and sometimes these become corrupt. The simple answer was as follows :-

If you saved a password for a network drive in windows and want to remove it, press the keys [Windows] + [R] to open the windows command line. Then enter

control keymgr.dll

and click on “OK” to open the windows credential manager which allows you to manage and delete passwords saved in Windows.

Highlight server and click REMOVE FROM VAULT

Reboot computer.

This procedure works for Windows XP, Vista and Windows 7.

brian
  • 51
  • 1
  • 1
2

I had the same problem. "You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions". All was working fine with samba until doing a fresh install of 11.10 (the upgrade install did not break samba shares).

I installed "Samba Server Configuration Tool 1.2.63" and it showed that the default user was nobody. Changed that to coincide with my password and all worked fine after that. I had compared my samba config files and nothing was different. The tool mentioned fixed it.

danb
  • 21
2

I had heaps of problems with this and just got it right so I thought I would just document it.

I think the final thing that set me right was opening the smb.conf file (/var/etc/samba/) and at the end of the file the folders that I thought were shared had a colon; before the browseable = yes which I removed. I think that was the final step.

I also previously changed the regedit on windows with a Win7_Samba3DomainMember.reg file (although I think I'm using Samba(1) --- alot of guess work going on here :> I found the gadmin-samba NOT useful, it made things worse, but I recon thats due to my limtied knowledge, but the other Samba Utility was vey helpful (system-config-samba).

Besides all the usual folder permissions the "personal file sharing" (accessed through the Dash) also had some simple configuration which I assumed would have not needed to be done.

brett
  • 21
  • 1
2

I completely uninstalled and purged samba and samba-common, then reinstalled them and all the packages that depended on them. Now the GUI sharing and computer's hostname works again, though it only works in Guest mode.

I haven't figured out what credentials to use otherwise. WINDOWSMACHINE/winusername UBUNTUMACHINE/ubuntuusername or just plain username. Nothing works. But Guest mode works.

The folders I'm sharing contain other folders. Sometimes these are inaccessible to the Windows machine and sometimes they're accessible. Apparently when it says "let me configure permissions for you", it only does i for the folder you're sharing, not the subfolders. If the folder permissions for "Group" and "Others" aren't set to "Create and delete files", then you can't access it in guest mode.

endolith
  • 624
1

for me it worked by simply commenting the line that says security = share and uncommenting the line that says security = user in smb.conf

0

I had the same problem when I wanted to share a drive. I had to edit my fstab to auto-mount the drive to my specified mount point. I then tried to configure the smb.conf file to share the drive. The drive did show in windows but I couldn't navigate it so I tried what you did but when I tried to do this under the share tab in the properties dialog box a message came up to insert this option in the global part of the smb.conffile:

usershare owner only = false

I then commented out my config to share that mount point in the smb.conf file.

This worked for me...

snoop
  • 4,110
  • 9
  • 41
  • 58
0
  1. If using Windows 7, you may need to change your registry settings:

    Execute the file Win7_SambaDomainMember.reg, which will insert the following registry settings (See the Samba wiki for details)

    HKLM\System\CCS\Services\LanmanWorkstation\Parameters
         DWORD  DomainCompatibilityMode = 1
         DWORD  DNSNameResolutionRequired = 0
    

    then reboot (I am not aware of any side-effects other than allowing access to Samba)

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

    sudo apt-get install python-glade2
    
-1

Try this from the Win7 box:

Control Panel > Administrative Tools

Local Security Policy > Local Policies > Security Options

Modify these entries:

Network security: LAN Manager authentication level Send LM & NTLM responses

Minimum session security for NTLM SSP Disable Require 128-bit encryption

nejode
  • 501