6

For some reason I've never been able to get Network shares working on Ubuntu, 12.04 nor 14.04. Although I have the desktop version, I've followed the server sharing advice here with no luck. The problem is the same on my wife's computer and the laptop. Shouldn't this just work out of the box?

I can't even get access to my shared folders through the "Browse Network" link from my own machine. Should I give up and use NFS?

enter image description here

Here's my smbtree and smbstatus output.

    WORKGROUP
    \\JAMES-UBUNTU          james-ubuntu server (Samba, Ubuntu)
        \\JAMES-UBUNTU\IPC$             IPC Service (james-ubuntu server (Samba, Ubuntu))
        \\JAMES-UBUNTU\Photosmart_Plus_B210 Photosmart_Plus_B210
        \\JAMES-UBUNTU\print$           Printer Drivers
        \\JAMES-UBUNTU\shareme          James Public Share
james@james-ubuntu:~$ smbstatus

Samba version 4.1.6-Ubuntu
PID     Username      Group         Machine                        
-------------------------------------------------------------------
Failed to initialize session_global: NT_STATUS_ACCESS_DENIED

Service      pid     machine       Connected at
-------------------------------------------------------
Failed to initialize session_global: NT_STATUS_ACCESS_DENIED
Failed to traverse sessions: NT_STATUS_ACCESS_DENIED

No locked files
  • do you have network sharing enabled on Windows?? This sounds like more a Windows refusing to share because sharing is not enable on a network level – Virusboy Dec 5 '14 at 15:15
  • I'm not using Windows. This is Ubuntu-Ubuntu. – James Bradbury Dec 5 '14 at 15:45
  • 1
    I had the same NT_STATUS_ACCESS_DENIED until I ran smbstatus as sudo. sudo smbstatus Also make sure you have samba listed in ufw if you are using it. – prodigerati Nov 5 '15 at 4:08
3

My answer doesn't directly relate to the error but to how to get sharing working. I had run up against the error BTW during this and so it does fix it in the end. Just not clearly so...

For Ubuntu 14.04 samba server and Ubuntu client it is possible to get it working. The method I wanted doesn't need a login...

My notes on this are a bit of a mess because of the sheer amount of configuration tests and trials that were made, No idea if some of it or all of it is required at this time and have steps for adding username and password as well. It was all a fail until the last line where I found smb:// was the only way it worked. Plus, no want to narrow it down:

You should try the last line first or use that through the process till it works. Simply going to browse network just doesn't ever seem to work otherwise as it puts up a login window that doesn't seem to allow access.


get latest samba (4.1.11) currently not found in ubuntu packages (may be necessary):

samba -V 
sudo add-apt-repository ppa:martinx/ig
sudo apt-get update
sudo apt-get upgrade samba
samba -V

Ubuntu Applications "Personal file sharing":
check "Share public files on network"
Require password "always"
Password "thesamepassword" used for user below

get the samba gui: ????? Might be needed to configure via here. Really don't know if it made a difference. I used a reboot to get it to show up in ubuntu applications:

sudo apt-get install samba libpam-smbpass samba-dsdb-modules samba-vfs-modules python-samba samba-common-bin samba-common samba-libs nautilus-share libgnomevfs2-extra

samba gui:

  • Preferences -> Server settings -> security tab: Auth mode: User, Encrypt passwords: yes, Guest: nobody

  • Preferences -> samba users: Same user as added below. Might to delete user below by changing -a to -x if added prior to.


If you have a permission error, this should fix it - though not the most secure way to do so and personally I do not care about this on my pc:

sudo chmod 777 -R /var/log/samba/* Needed????? No reason unless you need to.

have this installed if its not already:

sudo apt-get install libpam-smbpass

create samba user and password (I used my linux account user and password):

sudo smbpasswd -a user_to_add

sudo gedit /etc/samba/smb.conf

(starting with a fresh default smb.conf file and make the following changes (copy /usr/share/samba/smb.conf to /etc/samba/ if needed) (semicolon lines are ignored BTW):

[global]
force user = user_to_add #<---------------- ********** CHANGE **********

###authentication###
; passdb backend = tdbsam

###misc###
usershare allow guests = yes
username map = /etc/samba/smbusers
security = user
; encrypt passwords = yes
; guest account = user_to_add

[home] 
; comment = Home Directories
; browseable = yes
read only = no
create mask = 0755 
; directory mask = 0755
guest ok = yes

Almost there:

sudo samba restart
sudo restart smbd && sudo restart nmbd
or restart pc?

Go to a folder in home dir
right click -> local net share
Check "share this folder"
Check "Allow others to create..."
Check "Guest access"
Click create share

LAST LINE: Important.

browser or file explorer -> connect to server then:
smb://IP address of pc with samba server. (smb://192.168.1.99)

You can then bookmark it as well. Right click on it under network on the left of file explorer and bookmark.


There could be another way and the mess could be narrowed down, but after many hours this was the first time it worked and hopefully will not need to touch it till next LTS or so - if ever.

This is also usable on android without login.

On windows need to go to network explorer and type into the location field \\IP address of pc with samba server (\\192.168.1.99) and no login is needed.

Have fun :-D

Update: I had to do it again and this time doing it with 16.04 daily build

For 16.04 pre-release its mostly the same with a few slight differences...

sudo systemctl restart smbd.service && sudo systemctl restart nmbd.service

"Personal File Sharing" in Ubuntu applications isn't needed and isn't working properly.

Samba is at the latest release and doesn't need the ppa (at the moment I type this) BUT, make sure to install samba through whatever means necessary.

Samba gui isn't needed and thus probably not needed 14.04 either

I followed what's left above and the shared folder is showing up and browsable, write, and readable in Linux 14.04 (connection: anonymous) and Windows 10.

Windows 10: File explorer -> right click 'network' -> map network drive -> \IPaddress\shared folder name (or \IPaddress then click browse - but it looks like only one share folder per drive letter)

If using Windows 10 network backup and restore it requires a username and pass, just enter the samba ones and its ok (probably can be anything though) MAKE BACKUPS PEOPLE! :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.