2

I have two ubuntu (lubuntu 20.10) machines. On one of the machines, I created a folder and shared it using samba.

My entry in /etc/samba/smb.conf looks like this

[MyShare]
  comment = NO COMMENTS
  path = /home/user1/Documents/Shared
  read only = no
  guest ok = yes
  writeable = yes

For the folder /home/user1/Documents/Shared I have set permissions to 777.

From the second machine, I mounted the shared folder using cifs, using the below command

sudo mount -t cifs -o rw,guest,vers=2.0 //user1-pc.local/myshare /media/share

(user1-pc is the hostname of the first machine.)

Now, I am able to cd into /media/share, view contents of files using cat command. However, I am unable to create new files using touch command.

The command I used was, touch first.txt The error was, touch: cannot touch 'first.txt': Permission denied

I am new to working with permissions in linux. Kindly help me with overcoming the issue.

5
  • It's not any permission related? (I mean, locally or remotely, the file is not in a directory which only root (for example) has access to? (note: not in the local, I see you are running with sudo) but, another thing, do you think it could be the version? (e.g tried vers=3.0 instead of 2.0?) (if there is 3.0, if not - try 3) Commented Jun 19, 2021 at 14:56
  • 1
    Can you try specifying a guest account? The manpage for smb.conf says that the guest ok = yes option allows clients to connect without a password and with the privileges of the guest account. The default guest account is the 'nobody' user, which might explain the limited access. Link: samba.org/samba/docs/current/man-html/… Commented Jun 19, 2021 at 17:28
  • Sorry for my limited knowledge on UNIX: In that case, should I increase privileges of 'nobody' user? Commented Jun 20, 2021 at 1:42
  • 1
    @Kannan No, the preferred approach would be create a dedicated user account for this purpose, give it the appropriate permissions on the shared path as per your requirement, and then modify your Samba config to use that account. Commented Jun 20, 2021 at 5:24
  • Thanks a lot. I will do that. If you can post the same as answer I will mark as accepted. Commented Jun 20, 2021 at 5:44

1 Answer 1

3

For all the people that didn't read the coments on the original post, Haxiel said:

The man page for smb.conf says that the guest ok = yes option allows clients to connect without a password and with the privileges of the guest account. The default guest account is the 'nobody' user.

The preferred approach in this case would be to create a dedicated user account for this purpose, give it the appropriate permissions on the shared path as per your requirement, and then modify your Samba config to use that account. (Syntax: guest account = ftp).

2
  • Hi, thanks for writing this up. I've added some details and modified them a little so that this reads as a proper answer. Commented Jun 20, 2021 at 16:10
  • No problem, i will need to learn to make better awnsers... Commented Jun 20, 2021 at 17:34

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.