LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   samba shared folder between 2 linux pcs (https://www.linuxquestions.org/questions/linux-networking-3/samba-shared-folder-between-2-linux-pcs-4175614863/)

dancer_69 10-02-2017 03:13 AM

samba shared folder between 2 linux pcs
 
Hello,
I'm trying to setup samba to get access to a laptop's ntfs partition, from desktop pc. I want to only the user of desktop pc to have access read/write to laptop's partition which is mounted to /meda/data folder which belongs to laptop's user.
I have configured the laptop' s smb.conf like this:
Code:

[laptop-data]
path=/media/data
valid users=desktopuser
public=no
writable=yes
browsable=yes

I always get error when I input the password, that is wrong.
It confuses me the "valid users" option though. Is for the users of remote machine(desktop pc in my case), or the local users? I tried both(desktop and laptop user) but I get the same error. I also tried to set smbpasswd for desktopuser(in desktop pc), but I get the same error.
What am I missing?

IsaacKuo 10-03-2017 02:54 AM

You have to add the user (along with smb password) on the samba server, not the client. The list of samba users and passwords is independent of the normal users and passwords.

On the laptop, use the command:

Code:

smbpasswd -a desktopuser
This will both add the user and let you enter the samba password for dektopuser.

If you run smbpasswd on the desktop, or modify smb.conf (if it even exists) on the desktop, it will have no effect. These settings only affect the server, not the client. Therefore, it will only affect samba shares on the desktop (shared to other computers). It has no effect on how the desktop connects to samba shares on other computers.

dancer_69 10-03-2017 03:23 AM

Thanks for explanations.
The problem is that I tried to add the desktopuser in laptop by the command you mentioned but it doesn't work. I get the error:
Code:

failed to add entry for user desktopuser
EDIT:
I found that is needed to also create the desktopuser in laptop by adduser.
I found this info here:
https://ubuntuforums.org/showthread.php?t=1513840
I already configured my folder though using archwiki(without specific user access) and working fine.
Maybe I will try again this way in the future.
Thanks for help anyway.

michaelk 10-03-2017 06:57 AM

What distribution/version are running on your computers? Since both laptop and desktop are running linux there are multiple ways to connect without using samba. sftp would be the easiest since there is basically very little setup required.

In addition if connecting using samba both computers do not need to have the same username account but as stated you need to create a samba user/password on the laptop that matches your laptop real user. The valid user would be your laptop user name and not the desktop username although you already created an account with your desktop username.

Using sftp requires the ssh server to be installed/running on the laptop and opened in the firewall if running. Most file browsers have the capability to connect to another server using multiple methods. Typically you can select connect to server using sftp or specify a url (sftp://laptop_ip/media/data). You will then be prompted for your laptop username / password.

dancer_69 10-03-2017 07:21 AM

Ι' m running arch linux in both. I want to have read/write access to the folder(it's an ntfs partition actually). I tried nfs at first but I couldn't get write access, no matter which options I used. Now I've configured samba following arch wiki and I can browse/read/write the folder as guest user(I suppose) which doesn't need password. It' s not a big deal because there aren't any other pcs/users in network, so for now it's ok.


All times are GMT -5. The time now is 12:36 AM.