4

I want to access a folder on my new Ubuntu 12.10 box from any machine on my network without the need to provide credentials.

My machine name is Ubuntu1

I have a 2TB disk that formatted NTFS that has media on it

The mount point is mount1

I have numerous folders on the disk and I want to share each of them individually

I have enabled folder1 and folder2 for sharing

I have enabled shared access, Allow others to create and delete files in this folder and guest access is allowed.

The folder icon now has arrows so I assume all is good.

From windows I can see under network

Ubuntu1>folder1 Ubuntu1>folder2

When I click to open the folder from windows I get the error "You cannot access \Ubuntu1\folder1

You do not have permission to access \Ubuntu1\folder1

I have them both on the same workgroup.

Your assistance would be appreciated

3
  • please read this one wiki.ubuntu.com/MountWindowsSharesPermanently
    – user128296
    Dec 17, 2012 at 10:15
  • @user128296: That guide talks about mounting Windows shares on Ubuntu: Ron is trying to share folders from Ubuntu and mount them on Windows, which is quite different. Dec 16, 2013 at 18:31
  • Check that the path you are trying to share is correct in case you have directly entered the configuration in the samba config file
    – user320975
    Aug 27, 2014 at 11:25

5 Answers 5

6

Try running this command on your Ubuntu server:

sudo -u nobody ls "/path/to/my/share"

That will try to access your shared folder as user nobody. If you see an error like this:

ls: cannot access /path/to/my/share: Permission denied

then your local permissions are the problem (or at least a part of it).


Samba uses Linux filesystem permissions to determine whether it should grant access to shared files; if permissions block access to the shared folder itself, Samba will refuse to allow other machines to connect to the share at all. Guest access uses the nobody user (from group nogroup), so you should use the 'other user' file permissions to ensure that guests can access your shared folder.


It's important to check permissions on all the directories leading from / down to your shared folder too: if a user doesn't have execute permissions for a directory then they're prevented for accessing any paths below that point, including your share. (I created the ls error message above by removing 'x' permissions from an intermediate directory.)

Let's say you wanted to share /mnt/external/ntfs-drive/folder. You could add the 'x' permissions on all the parent directories with this command:

sudo chmod o+x /mnt /mnt/external /mnt/external/ntfs-drive

You also need to set read, write and execute permissions for the shared folder and any contents, but for parent directories execute permission is enough.

3
  • (Just in case it's not obvious to everyone else:) If the Samba logs say stat of /var/lib/samba/usershares/myshare failed. Permission denied then you should ignore what that actually says, and instead try reading it as stat of THE SHARED FOLDER NAMED BY /var/lib/usershares/myshare failed. Permission denied.... Dec 16, 2013 at 18:42
  • this solved my problem seeing an smb share on ubuntu 21.10 from macos 11.6.2. the permissions on ~ (/home/login-name/) are drwxr-x--- but need to be drwxr-x--x. using the gui to share a directory inside ~ with guest access does not fix this, but your fix does. as for non-guest access, any idea why my ubuntu username/password are rejected when trying to connect? does something have to be set up in the samba serving config? also, i get file transfers of 8MB/s when i push to the server from the mac. when i pull from the mac on the server, i only get 3MB/s, any idea why? Jan 5, 2022 at 4:26
2

Samba needs you to authenticate as a valid user.

You either have to enable guest access or create a user with the same username/password combination on Windows...

2

I had the same problem where I could not share files even with the guest access enabled. I also had the same stat permission denied errors in my log. Apparently these errors are "normal" and are not the real problem. In my case the problem was my home directory permissions. My permissions were rwx for the user and no permissions for group or other. Setting the execute bit for "other" users fixed the problem. Something like this should do the trick:

sudo chmod o+x /home/your-home
1

Hi the answers already here are good and correct but they do not show that there is a very easy way to fix this using the Ubuntu GUI way.

Right click on your folder you want to share got to the sharing properties and choose,

Allow others to create and delete files in this folder

and

Guest Access (for people without a user account)

as this image shows.

enter image description here

or you can do as Falstaff has correctly said to create an account on Windows with the same user name and pass, or vice versa, create a unix account with the same user pass.

6
  • Sorry I am Lynx newbie and am not real comfortable with the terminal advice given I can't easily translate from the example to my system.
    – Ron
    Dec 18, 2012 at 11:25
  • This is exactly how I changed permissions. I rebooted and have found these errors in log files [2012/12/17 20:22:04.543567, 0] smbd/service.c:1055(make_connection_snum) canonicalize_connect_path failed for service Music, path /media/ron/wd2tb_bottom/Music
    – Ron
    Dec 18, 2012 at 11:37
  • Other errors[2012/12/17 20:23:28.523873, 0] smbd/service.c:1055(make_connection_snum) canonicalize_connect_path failed for service AudioBooks, path /media/ron/wd2tb_bottom/AudioBooks [2012/12/17 20:28:16.968188, 0] param/loadparm.c:9114(process_usershare_file) process_usershare_file: stat of /var/lib/samba/usershares/audiobooks failed. Permission denied
    – Ron
    Dec 18, 2012 at 11:41
  • [2012/12/17 20:46:59.237641, 0] param/loadparm.c:6498(canonicalize_servicename) canonicalize_servicename: NULL source name!
    – Ron
    Dec 18, 2012 at 11:41
  • 2012/12/17 22:41:21.644314, 0] lib/util.c:1117(smb_panic) PANIC (pid 3056): internal error [2012/12/17 22:41:21.757819, 0] lib/util.c:1221(log_stack_trace) BACKTRACE: 23 stack frames: #0 smbd(log_stack_trace+0x29) [0xb718e8a9] #1 smbd(smb_panic+0x28) [0xb718e9a8] #2 smbd(+0x42daf2) [0xb717daf2] #3 [0xb6d2d400] .... smb_panic(): action returned status 0 [2012/12/17 22:41:22.052098, 0] lib/fault.c:372(dump_core) dumping core in /var/log/samba/cores/smbd
    – Ron
    Dec 18, 2012 at 11:43
-1

As falstaff explained, you need to allow guest from your Ubuntu1 machine or create credentials.

I suggest you to have a look at this guide.

I used it to fix access from both sides (linux/windows clients) to access other SMB shares.

1
  • Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Dec 19, 2012 at 6:28

You must log in to answer this question.

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