You are not logged in.

#1 2021-04-26 11:27

tomas
Member
Registered: 2021-04-26
Posts: 12

Samba configuration

I'am new to Linux and i recently install Q4os to be my server beetwen Linux and Windows, i'am using samba to share folders and files, i can acess the folders from Windows 10,but i have no permissions to create or edit files, shows me this message "You need permissions to this action", i dont know where or the commands to give pemissions to the user on Windows can edit this filesor create new ones.
My file samba.conf its like this:
[global]
    server role = standalone server
    map to guest = bad user
    usershare allow guest =yes
    hosts allow =192.168.0.0/16
    hosts deny = 0.0.0.0/0
[testeshare]
    comment = test share
    path = /etc/samba/files
    writeable = yes
    browseable = yes
    read only = no
    create mask = 0644
    directory mask = 0755
    forceuser = shareuser
    guest ok = yes

what can i do to give permissions?

Offline

#2 2021-04-26 13:19

Tolkem
Member
Registered: 2019-10-06
Posts: 487

Re: Samba configuration

tomas wrote:

I'am new to Linux and i recently install Q4os to be my server beetwen Linux and Windows, i'am using samba to share folders and files, i can acess the folders from Windows 10,but i have no permissions to create or edit files, shows me this message "You need permissions to this action", i dont know where or the commands to give pemissions to the user on Windows can edit this filesor create new ones.
My file samba.conf its like this:
[global]
    server role = standalone server
    map to guest = bad user
    usershare allow guest =yes
    hosts allow =192.168.0.0/16
    hosts deny = 0.0.0.0/0
[testeshare]
    comment = test share
    path = /etc/samba/files
    writeable = yes
    browseable = yes
    read only = no
    create mask = 0644
    directory mask = 0755
    forceuser = shareuser
    guest ok = yes

what can i do to give permissions?

If the current share is /etc/samba/files, you should change that. This is an essential system directory,  I mean /etc, where most software save its configuration files and stuff, and any unwanted change in that directory may leave your system unusable and this is also why you get a permissions' error since it's not intended to be used by anyone other than root. So, I suggest you to change that immediately. You could for example place the files in it somewhere else like /mnt.
1. Create a dir in /mnt

sudo mkdir /mnt/my_share_files

2. Mount the dirctory

sudo mount /mnt/my_share_files

3. Move the files in /etc/samba/files over there

sudo mv /etc/samba/files /mnt/my_share_files

4. Edit /etc/samba/smb.conf to reflect the changes

[testeshare]
	comment = test share
	path = /mnt/my_share_files
	writeable = yes
	browseable = yes
	read only = no
	create mask = 0644
	directory mask = 0755
	forceuser = shareuser
	guest ok = yes

Also, I don't think you need forceuser option.

Offline

#3 2021-04-26 14:41

tomas
Member
Registered: 2021-04-26
Posts: 12

Re: Samba configuration

Well you are right, i do the changes for a new directory, and i can now acess the files directory, but on windows say that i need permission to do changes in the directory. You know how what can i do?
Thank you for the fast ansewr.

I will leave the work in 2 hours, but i will try to do all this again at home, i need this done by tomorow at 20, well you can see that i'am not very good at linux, so i will let my email, if you can send me an email and we can talk better.

Email:3642.tomas.luis@eped.pt

Apreciate
Tomás Luís

Last edited by tomas (2021-04-26 14:54)

Offline

#4 2021-04-26 15:51

Tolkem
Member
Registered: 2019-10-06
Posts: 487

Re: Samba configuration

tomas wrote:

Well you are right, i do the changes for a new directory, and i can now acess the files directory, but on windows say that i need permission to do changes in the directory. You know how what can i do?
Thank you for the fast ansewr.

I will leave the work in 2 hours, but i will try to do all this again at home, i need this done by tomorow at 20, well you can see that i'am not very good at linux, so i will let my email, if you can send me an email and we can talk better.

Email:3642.tomas.luis@eped.pt

Apreciate
Tomás Luís

I'm not a samba expert by any means, but you may try removing

create mask = 0644
directory mask = 0755
forceuser = shareuser

And see if that works.

Offline

#5 2021-04-26 16:20

tomas
Member
Registered: 2021-04-26
Posts: 12

Re: Samba configuration

I already try that, and dosen't do much, you know how to give permissions to a user that he can write. read and execute the files in windows,
or to give permissions to guests so they can that?

well, now when i try to edit a file windows said: "requires user / root permission to make changes to this folder"

Last edited by tomas (2021-04-26 16:42)

Offline

#6 2021-04-26 17:20

Tolkem
Member
Registered: 2019-10-06
Posts: 487

Re: Samba configuration

tomas wrote:

I already try that, and dosen't do much, you know how to give permissions to a user that he can write. read and execute the files in windows,
or to give permissions to guests so they can that?

well, now when i try to edit a file windows said: "requires user / root permission to make changes to this folder"

You mean the files in your share directory? Hmmm ... open konsole, run these commands and copy/paste the output here, please:

cd /mnt/my_shared_files

Change the path accordingly, if the about is not correct.

ls -la

This check who own the files. I suspect that when moving the files over the new directory from /etc, which is owned by root, the permissions remain the same, so depending on the output it might be needed to set those properly for your user to be the owner of the files.

Offline

#7 2021-04-27 09:53

tomas
Member
Registered: 2021-04-26
Posts: 12

Re: Samba configuration

dc@q4os-desktop:/mnt/fileshare$ ls -la
total 12
drwxr-xr-x 3 root WORKGROUP 4096 abr 26 14:31 .
drwxr-xr-x 4 root root      4096 abr 26 15:44 ..
drwxr-xr-x 2 root root      4096 abr 26 15:39 files
dc@q4os-desktop:/mnt/fileshare$
                                   
this is what shows when i put ls -la command

Offline

#8 2021-04-27 14:05

Tolkem
Member
Registered: 2019-10-06
Posts: 487

Re: Samba configuration

tomas wrote:

dc@q4os-desktop:/mnt/fileshare$ ls -la
total 12
drwxr-xr-x 3 root WORKGROUP 4096 abr 26 14:31 .
drwxr-xr-x 4 root root      4096 abr 26 15:44 ..
drwxr-xr-x 2 root root      4096 abr 26 15:39 files
dc@q4os-desktop:/mnt/fileshare$
                                   
this is what shows when i put ls -la command

Yeah, it's just like I thought, the files are owned by root and that's why you can't do anything with them. Open konsole and run this:

cd /mnt/fileshare

then run this command to make your user_name the owner of the files

sudo chown -R your_user_name:your_user_name /mnt/fileshare

Replace your_user_name by your actual user_name, that is, the one you log in to Q4OS, then run the ls -la command again to verify that you're the owner now, which you should be.

Offline

#9 2021-04-28 09:18

tomas
Member
Registered: 2021-04-26
Posts: 12

Re: Samba configuration

I do that and show me this

dc@q4os-desktop:~$ cd /mnt/fileshare
dc@q4os-desktop:/mnt/fileshare$ sudo chonw -R dc:dc /mnt/fileshare
[sudo] senha para dc:
dc não está no ficheiro sudoers. O incidente será reportado.
dc@q4os-desktop:/mnt/fileshare$ ls -la
total 12
drwxr-xr-x 3 root WORKGROUP 4096 abr 26 14:31 .
drwxr-xr-x 4 root root      4096 abr 26 15:44 ..
drwxr-xr-x 2 root root      4096 abr 27 11:39 files
dc@q4os-desktop:/mnt/fileshare$

Offline

#10 2021-04-28 15:40

Tolkem
Member
Registered: 2019-10-06
Posts: 487

Re: Samba configuration

tomas wrote:

I do that and show me this

dc@q4os-desktop:~$ cd /mnt/fileshare
dc@q4os-desktop:/mnt/fileshare$ sudo chonw -R dc:dc /mnt/fileshare

You made a typo; you wrote chonw and that's wrong, the correct command is chown chown = change ownership try again and make sure you type the right command this time; no typos. Then verify that the ownership of the files has been set correctly with ls -la.

dc não está no ficheiro sudoers. O incidente será reportado.

Looks like your user dc is not part of the sudoers group, please, run this in konsole and copy/paste the output here:

id

Last edited by Tolkem (2021-04-28 15:46)

Offline

#11 2021-04-29 09:23

tomas
Member
Registered: 2021-04-26
Posts: 12

Re: Samba configuration

I do the command rigth and shows me this


dc@q4os-desktop:~$ cd /mnt/fileshare
dc@q4os-desktop:/mnt/fileshare$ sudo chown -R dc:dc /mnt/fileshare
[sudo] senha para dc:
dc não está no ficheiro sudoers. O incidente será reportado.

When i do id command shows this

dc@q4os-desktop:/mnt/fileshare$ id
uid=1000(dc) gid=1000(dc) grupos=1000(dc),1004(WORKGROUP)

Offline

#12 2021-04-29 13:35

Tolkem
Member
Registered: 2019-10-06
Posts: 487

Re: Samba configuration

tomas wrote:

I do the command rigth and shows me this


dc@q4os-desktop:~$ cd /mnt/fileshare
dc@q4os-desktop:/mnt/fileshare$ sudo chown -R dc:dc /mnt/fileshare
[sudo] senha para dc:
dc não está no ficheiro sudoers. O incidente será reportado.

When i do id command shows this

dc@q4os-desktop:/mnt/fileshare$ id
uid=1000(dc) gid=1000(dc) grupos=1000(dc),1004(WORKGROUP)

Well, it looks indeed that your user dc isn't a member of the sudo group, which is weird because you used it to move the files from /etc, unless you didn't, so I ask, did you move the files from /etc to the new location using sudo? If you created a root password when installing Q4OS, you can add dc to the sudo group:
1. Open konsole and type

su -

Type in the root's password and hit Enter
2. As root, type this in konsole

usermod -aG sudo dc

Hit Enter to run the command.
3. Log out the root account by  pressing Ctrl + d
4. Verify that dc is part of the sudo group now with

id

5. Try running the chown command again.

Offline

#13 2021-04-29 14:15

tomas
Member
Registered: 2021-04-26
Posts: 12

Re: Samba configuration

dc@q4os-desktop:~$ su -
Senha:
su: Falha de autenticação




give me this error too
user não está no ficheiro sudoers. O incidente será reportado.

Last edited by tomas (2021-04-29 14:19)

Offline

#14 2021-04-30 03:12

Tolkem
Member
Registered: 2019-10-06
Posts: 487

Re: Samba configuration

tomas wrote:

dc@q4os-desktop:~$ su -
Senha:
su: Falha de autenticação




give me this error too
user não está no ficheiro sudoers. O incidente será reportado.

You have to type root's password, not your user's. Did you create a root account and password when installing Q4OS? If you didn't, you will have to:
1. Boot to Q4OS from a Live USB.
2. Mount the partition where Q4OS is installed: open the file manager, locate the partition. click on it to mount it.
3. Navigate to /etc, right-click in a blank space and from the context menu select open terminal here or some similar wording.
4. In konsole edit the /etc/group and /etc/sudoers files like this:

sudo nano /etc/group

5. Press enter, you shouldn't be asked to type any password since you're using a live USB. Locate the line that reads

sudo:x:27:tolkem

this is how it looks for me, but it'll be different for you, if you don't see that line, just add it

sudo:x:27:dc

6. Press Ctrl + o to save the file, and hit Enter, then press Ctrl + x to exit nano.
7. Now edit /etc/sudoers

sudo nano /etc/sudoers

8. Press enter and locate the line that reads

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

and edit it so it looks like this

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
dc          ALL=(ALL:ALL) ALL

9. Press Ctrl + o to save the file, and hit Enter, then press Ctrl + x to exit nano.
10. Restart your pc, open konsole and type

sudo chown -R dc:dc /mnt/fileshare

type in your password when asked, hit Enter and it should work this time.

Last edited by Tolkem (2021-04-30 15:31)

Offline

#15 2021-05-06 09:59

tomas
Member
Registered: 2021-04-26
Posts: 12

Re: Samba configuration

I do something wrong from the begining, so im gonna restart everthing and im going to install q4os again, if u could help from there would be excelent if not thanks for your time

Offline

#16 2021-05-06 12:28

Tolkem
Member
Registered: 2019-10-06
Posts: 487

Re: Samba configuration

tomas wrote:

I do something wrong from the begining, so im gonna restart everthing and im going to install q4os again, if u could help from there would be excelent if not thanks for your time

Sure, no problem.

Offline

#17 2021-05-10 09:29

tomas
Member
Registered: 2021-04-26
Posts: 12

Re: Samba configuration

Well, i install do all the things again, and now i can create files and folders on linux and windows but when i create on linux i cant edit on windows, but when i create on windows i can edit on Linux, you know something about that?

Last edited by tomas (2021-05-10 10:56)

Offline

#18 2021-05-10 18:26

Tolkem
Member
Registered: 2019-10-06
Posts: 487

Re: Samba configuration

tomas wrote:

Well, i install do all the things again, and now i can create files and folders on linux and windows but when i create on linux i cant edit on windows, but when i create on windows i can edit on Linux, you know something about that?

It's probably some permissions' error. Did you use the same settings as before?

Offline

Board footer

Powered by FluxBB