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?

6
  • 1
    Related Question: askubuntu.com/questions/14345 Dec 30, 2010 at 4:41
  • Related Question: askubuntu.com/questions/12254 Dec 30, 2010 at 4:42
  • Related Question: askubuntu.com/questions/17770
    – endolith
    Jan 14, 2011 at 18:57
  • 1
    I have the same Problem. It used to work without problems. I could access the ubuntu pc it used to ask for username - password and everything was ok After an update that took place 2 days ago for me, i started having the same problem. Now i can access the shared folder only when it is in guest mode. When it is not in guest mode, it asks for a username password but when i type it, it says " \\Ubuntu\downloads is not accessible.You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions Multiple conne
    – user10231
    Feb 5, 2011 at 22:15
  • after 2 hrs of frustration, I solved this problem by restarting my computers...
    – Yibo Yang
    Aug 22, 2016 at 1:08

10 Answers 10

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!

3
  • 1
    I'm not sharing from Windows. I'm sharing from Ubuntu and accessing it from Windows 7. Samba is already installed, but I'm using the GUI to share, not the command line.
    – endolith
    Dec 30, 2010 at 17:00
  • Is gadmin-samba the official tool to configure this? Why would I need to configure a user or password separately from sharing the folders?
    – endolith
    Jan 6, 2011 at 3:45
  • To create a shared folder, accessible through Win7, in Ubuntu 13.04, I did: sudo smbpasswd -a USERNAME to create a samba user for me, then used right-click menu options to set sharing and permissions. As I created a shared folder outside of my home folder, I had to right-click the folder and set permissions to Owner, Group, and Others - Access: Create and Delete Files. I did not alter my smb.conf and this file does not show any shares configured within. This GUI process seems to work outside of SAMBA's conventions. This is worrying and confusing.
    – Rich.T.
    Jul 1, 2013 at 17:51
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.

3
  • It works! But.... why??
    – endolith
    Mar 3, 2011 at 6:02
  • I had the same problem. I am not sure why it does not allow guest access. May be Ubuntu thought that it was a security flaw that could be exploited. I guess there is some other setting that needs to be enabled for the guest access option to work. Maybe that's why they did not totally remove that option.
    – BZ1
    Mar 7, 2011 at 5:33
  • now it doesn't work. why is samba such a nightmare?
    – endolith
    Dec 11, 2016 at 3:21
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.

1
  • This saved my day.
    – Emily L.
    Aug 7, 2015 at 13:23
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.

2
  • 1
    AFAIK, you've got to use your plain Ubuntu username. Can you access the folder (not yet the subfolders)? Have you got system-config-samba? If so, open System -> Administration -> Samba, and check Preferences -> Samba users
    – luri
    Jan 20, 2011 at 9:25
  • 1
    @luri Thousand times thank you for mentioning system-config-samba. Why oh why is the default state of things still so dysfunctional for something this basic. How is anyone supposed to know their user account isn't enabled as a samba account when you need some obscure additional software to even tell. This needs to be integrated into the System Settings > Users section. Either that or it needs to be integrated into the actual share properties.
    – Enigma
    Oct 26, 2015 at 15:41
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.

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.

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
  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
    
2
  • Can you explain what this does? Does it have side effects?
    – endolith
    Jan 4, 2012 at 20:53
  • @endolith I have updated my answer. Jan 4, 2012 at 20:59
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...

-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

2
  • Can you explain what this does? Does it have side effects?
    – endolith
    Jan 16, 2011 at 0:58
  • Not any that I know of. This only opens up Win7 to the samba protocol. I use it in the office where 3 Win7 machines connect to an Ubuntu server. Try it out, you can always change everything back easily if you need to... which I doubt.
    – nejode
    Jan 16, 2011 at 11:47

You must log in to answer this question.

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