File sharing

Borg

New Member
Joined
Oct 9, 2019
Messages
13
Reaction score
8
Credits
0
I installed Linux CNC on an older computer about a year ago. It came with debian wheezy. Everything works great but now I want to send CNC files to this computer from my desktop windows 10 computer where I build my g code files. I will try to describe my failures:

# apt-get install samba
#apt-get install samba-client

I go to my file system and click on "etc" and then "samba" then "smb.conf"
I make some minor changes and click "save"
I get the error message "Can't open file to write"

I'm sure you can tell that I know zero about Linux programming.

When I go to my Windows computer and look at the network, the linux computer does not show up in connected devices. If I log on to my router the linux computer shows up with the name debian.

That's where I am and it took all day to get here.

All I want to do is send g-code files from my Windows computer to the Linux computer.

Help would be appreciated.
 


You have to modify the file using elevated rights. In Windows, you have an account that can automatically elevate to admin by clicking that approve button in the popups. Some Linux apps allow this but most need to be started with elevated rights. So in order to edit the smb.conf file you need to launch it from the command line rather than your gui file manager. try this instead open Terminal and type (without the quote marks) 'sudo /etc/samba/smb.conf'. Sudo allows you to run the rest of the command with admin rights.
 
I entered the command as you suggested and was asked for my password. I entered it and this was the next line:
sudo: /etc/samba/smb.conf: command not found
 
Hello,
I think he typed a little to fast
Code:
$ sudo gedit /etc/samba/smb.conf

sudo is a command to run the next command as a privilegied user, gedit is the gnome deskopt text editor (equivalent of windows notepad), then there is the config file path.
 
In the meantime I found this: sudo -i
From there I was able to use the cd command to get to the samba folder.
Then I used: nano smb.conf
The file opened in a editable window.
So I am that far but have been getting mixed signals on what needs to be modified to set up file sharing.

Thanks for the help so far. Maybe somebody can help me with the required modifications to the conf file. I think I have to set up a separate login for samba. Should there be an executable on the samba folder? How is the program invoked? All that's on there is "samba.conf" and "gdbcommands" which just has 2 words in it.

Thanks again for all the help.
 
Maybe somebody can help me with the required modifications to the conf file
I'll do my best but I havn't been using samba for a while. You will find plenty of configuration tutorials on the web.

Should there be an executable on the samba folder
On Linux almost everything has it own defined place. Binaries are in /bin, /usr/bin... config files are in /etc... You should take a look at https://refspecs.linuxfoundation.org/fhs.shtml. So /etc/samba/ is the system configuration directory for samba, it's not meant to contain any binary.

How is the program invoked?
Linux uses a lot of daemons. https://en.wikipedia.org/wiki/Daemon_(computing). There are some common mechanism to start a daemon automatically. Most commons are systemv, which uses scripts in /etc/init.d, and systemd, a new mechanism that uses configuration files.
Your samba server will be started automatically by one of thoses ways. Since you're on debian 7 I think it's still systemv.
 
I'm very rusty with samba too, and only rarely used it long ago. But scroll down to "Option Two" in this article to see if it is clear enough to get you going. This method seems that it will allow you to send your CNC files from Windows to Linux (but not send files from Linux to Windows... that's "Option One").

Where the article says to use "vi" to edit the smb.conf file, use "nano" instead since you've already found it. I think "vi" is more confusing for people who are not familiar with it. If you aren't too familiar with nano either, remember that you need to CTRL-W (Write out) the file after you make changes... that is what saves the file, then CTRL-X to exit. And you have to open nano using sudo or else you won't be able to save it.

The article above shows the basics of what to add to smb.conf, but you need to know your own values... your "path" to the folder you want to share, etc. Another article also says that instead of making a user login, you can make an entry as guest ok = yes so that you could transfer files without a password. Depends on your thoughts about security on your network.

There are YouTube videos on settng up samba, but I didn't watch any to determine whether they are good instructions, or not. If you search them out, look for more recent videos instead of older ones. If you find Debian-specific stuff, that would be great, but instructions for Ubuntu and/or Linux Mint would likely work out as well with Debian.

Cheers
 
I'm very rusty with samba too, and only rarely used it long ago. But scroll down to "Option Two" in this article to see if it is clear enough to get you going. This method seems that it will allow you to send your CNC files from Windows to Linux (but not send files from Linux to Windows... that's "Option One").

Where the article says to use "vi" to edit the smb.conf file, use "nano" instead since you've already found it. I think "vi" is more confusing for people who are not familiar with it. If you aren't too familiar with nano either, remember that you need to CTRL-W (Write out) the file after you make changes... that is what saves the file, then CTRL-X to exit. And you have to open nano using sudo or else you won't be able to save it.

The article above shows the basics of what to add to smb.conf, but you need to know your own values... your "path" to the folder you want to share, etc. Another article also says that instead of making a user login, you can make an entry as guest ok = yes so that you could transfer files without a password. Depends on your thoughts about security on your network.

There are YouTube videos on settng up samba, but I didn't watch any to determine whether they are good instructions, or not. If you search them out, look for more recent videos instead of older ones. If you find Debian-specific stuff, that would be great, but instructions for Ubuntu and/or Linux Mint would likely work out as well with Debian.

Cheers
I was able to make the modifications to smb.conf and save it thanks to your help. There is something I am either doing wrong or not doing though. I can ping each computer from the other without any problem but I'm not able to see them on the network from either one. I'm about to give up but it's hard to because I might just be one little fix away from success. Had I known what I was in for I never would have started. I'll probably just go back to using the USB drive for now.
 
Well, you could probably ping each computer before the sharing project began. o_O Ping is just a simple test to show a computer is reachable on the network. You can ping google.com with an internet connection, but it doesn't mean that you can directly share files with them, or that they can directly share files with you. Thank goodness! I'm sure Google would suck everything out of your computer, if they could! :eek::D

Of course, it is required that a computer is reachable on the network to be able to share files too. Your router probably issues IP address to both your Windows and Linux computers using DHCP, so ping should work among any computers on this network. That ping does work is good to know so it rules out a connectivity problem.

So, sorry, but we still don't know where you're at for actual file sharing.... whether Linux and the smb.conf is setup correctly, or whether you're having problems telling Windows how to reach this network share. But even though I am rusty at this, I know it can still be done... but it seems like folks don't ask about it much anymore either. If you decide to give up on it, here's some other thoughts or ideas....

1. Back to USB, as you said. Tried and true! But requires walking!

2. Use a NAS (Network Attached Storage). Some routers have a USB port in the back for file storage. You might could send your data files to such a storage from Windows, then retrieve it from your Linux box. There are also special NAS storage devices (hard drives), but probably not worth the cost unless you have other purposes. May be as hard to setup as samba file sharing!

3. If both computers have internet access, use cloud storage, like Dropbox or Google Drive (or other). There should be some amount of storage available for free that may can handle your needs. I think some allow you to encrypt your files too, so you might prevent snooping or theft of intellectual property.

4. Finally, I don't know much about it, but Windows 10 is somehow able to run a Linux command line now. If you can manage that, there is a program called rsync that is an excellent backup tool, and I think it would be a good method for you to transfer your data files. rsync works across networks, local or internet. Like all command line tools, you have to be careful with it.... only work with copies of data to be sure that nothing unexpected happens to originals.

Cheers
 
I was able to make the modifications to smb.conf and save it thanks to your help. There is something I am either doing wrong or not doing though. I can ping each computer from the other without any problem but I'm not able to see them on the network from either one. I'm about to give up but it's hard to because I might just be one little fix away from success. Had I known what I was in for I never would have started. I'll probably just go back to using the USB drive for now.

The problem for me is that you didn't tell us what you did and didn't provide the actual configuration you are using or any log file. We are good at guessing but we are simple human beings.

For what I remember Samba works out of the box. Make sure you set the same workgroup in the samba configuration file as the one being used on windows, restart samba with "systemctl restart samba" or by rebooting, make sure your windows has network discovery and other related stuff enabled, eventually disable the firewall.

If its too much for you now this is not a problem, don't go crazy and take a little break we will still be there later :)
 
This is what I have done:

smb.conf
In Shares definitions.

[homes]
read only = no

[Share ncfiles]
path = /home/me/Documents/ncfiles
available = yes
valid users = me
read only = no
browsable = yes
writable = yes

I added an smb password but forgot how I did it. I can resurrect if needed.

I then restarted linux.

Went to my windows computer, no linux. Logged onto router and it was there. debian ip address and mac address.

Downloaded newest router update.
Went to advanced settings and made debian available to network.
Checked windows network, no debian.
pinged debian successfully.
Entered this in network window: \\debian ip address
would not connect.
ran network troubleshooter.
It said: Problem found, remote device won't accept the connection.

Not sure what that means but that is where I am now. It seems odd that all other devices that show up when I log onto the router show up in Windows network except linux/debian.
 
It seems odd that all other devices that show up when I log onto the router show up in Windows network except linux/debian.

It probably tied to the same problem. I think you missed a part of my last message : make sure that smb.conf has the same network group as your windows machines. Its in smb.conf
Code:
[global]
...
 workgroup = WORKGROUP
...

Eventually give us the output of the following command after trying to connect :
Code:
journalctl -u samba
 
On your Windows 10 File Explorer, in the address bar, enter "\\SAMBA" (without quotes, but try all caps or no caps both). Also try to enter "\\192.168. [Linux IP address]" (again, with no quotes). See if either show your Linux shared folder. Another chance is to enter "\\SAMBA-SERVER" (no quotes, try upper and lower case like before). Here's a couple of pics on the web as examples: #1 and #2.

When you set the smbpasswd, did you use the username "me" that you show in your smb.conf? This should match your Linux username. (The example in the link I provided showed "geek" instead.)
Code:
sudo smbpasswd -a me

If "me" is not the real Linux username, then at least be sure that smb.conf and all this stuff does match a real Linux user.

In the link I sent earlier, one item that showed in the shared section that you did not include is public = yes. I don't know if that's needed, just pointing it out. Likewise, you changed [Share] in the example to [Share ncfiles].... and I don't know if that makes a difference (yes, I see on another website that it looks fine to give it your own name).

In [homes] you may need to add browseable = yes like in [Share]. Again, not sure... but your share is in a subfolder of your home.

If you make any changes to smb.conf as shown above, restart samba in Debian with:
Code:
sudo systemctl restart smbd

Different websites show some slightly different variations on the instructions to set up the samba connection. But I think all of the above should be enough to get you going. Windows 10 has brought some new issues, and we might have to explore those more if you don't get it working.... but we don't want to if not needed (may cause more problems).
 
Entered this in the explorer window: \\(actual debian ip)
would not connect.
ran network troubleshooter.
It said: Problem found, remote device won't accept the connection. Like I said, I know it's there, I can ping it.

I also tried with \\Samba as you suggested with no luck.

I entered my real password not "me"

I have tried the smbd restart in every conceivable way with the same result "command not found"

I have also tried "journalctl -u samba" with every variant I know of and get "command not found" . It's very frustrating.


I installed nmap, seemingly successfully. When I try to invoke it which is "sudo nmap -sn 192.168.1.0/255"
I get the same " nmap: command not found"

One video I saw mentioned that the usernames have to match on both computers. I have no username or password on my windows computer and so far I have not been asked for one during any attempt to connect.

I am wondering if I have to include my smb password in this connection attempt "\\(ip address) (shared file path)

Also I am not really clear on the how the path works. For example, when I open the terminal window I get this "warren@debian:~$ "
No matter what I type in I cannot get to "/etc/samba/smb.conf"

The only way I have been able to get there is this; "sudo -i"
Then I get this "root@debian:~#" . Then "cd /etc/samba" works just fine.

I don't understand the Linux file system which could be the issue.
 
So just to clarify you're entering the path/IP in the file explorer address bar or are you using the map network drive dialog? If you haven't tried yet you might want to try and select the option to use different credentials.


4484


Also, Can you check via PowerShell: Test-Netconnnection <ip> -port 445 and Test-Netconnnection <ip> -port 139?
 
I entered my real password not "me"
Let's start here. "Me" is not the password... it is the Linux user. Further down you showed your command prompt as "warren@debian" so your user name is warren. You create the samba password for warren like this:
Code:
sudo smbpasswd -a warren
After entering this command, it should ask you to enter the password, twice probably. You won't see any characters echo back on your screen, not even ****. So enter it carefully, and don't forget it.

I don't know why Debian doesn't let you "cd" into /etc/samba as the user warren, but you are able to become root with "sudo -i" so that is good enough. As root, edit /etc/samba/smb.conf and make sure that your [Share ncfiles] section does not say "me".... so, "path = /home/warren/Documents/ncfiles" and also "valid users = warren". Save the file if you needed to make these changes. Also be sure that you have already created the "ncfiles" folder in your Documents folder... it needs to exist already, and it probably needs to be all lowercase, like your smb.conf shows.

Restarting samba.... not sure what's happening here, but you need to restart for changes above to take effect, if you made changes. Rebooting Debian will also work, but it's more trouble. Be sure the commands to restart always begin with sudo, or that you are root when giving the command. Here is one more way:
Code:
sudo service smbd restart


One video I saw mentioned that the usernames have to match on both computers. I have no username or password on my windows computer and so far I have not been asked for one during any attempt to connect.
I've wondered about this.... it might make it easier if your Windows user was named warren, but I would not think it's necessary. But you DO have a Windows user account, whatever that name is. Windows requires you to create a user when installing, just like Linux. It may be "me" or "user"... but there must be something, even if it lets you run Windows without logging on with user/password credentials. At least one user must have Administrator privileges, or else you would not be able to do some things, just like with Linux.

NMAP: Your command should end with /24 instead of /255, but other than that it should run and not give a "command not found" error if you installed correctly. Try these 4 commands below and see what they say:
Code:
which nmap
nmap --version
which samba
samba --version
 
sudo smbpasswd -a warren
That's what I did when I first set it up. It then asked me to type it in twice.

I tried Nmap both ways. with "0/24 and 255". I tried a lot of things.

My name is listed as owner in Windows but it's my complete name and it uses caps. I don't understand how that could effect the situation.
Not having a username and password in Windows however might. I don't know.

I also tried to install "tree" so I could get an idea of what the file system looks like. It tried to install but as it was displaying what it was doing there were errors. I guess it didn't install because it doesn't work.

I really do appreciate the help some of you have tried to give me but It seems I'm just not capable of doing simple Linux tasks. I did see somewhere that debian 7 has some limitations but my guess it that it's me.
 
I did see somewhere that debian 7 has some limitations but my guess it that it's me.
It may well be Debian. Don't feel bad about struggling to make something work and not succeeding.... I think we've all been there. And Debian is not the most friendly (but it is a rock solid distro).

Debian 7 (Wheezy) reached end-of-life over a year ago, and that makes me wonder if your commands to install samba, samba-client, and nmap worked properly. The "which" and "--version" commands in my previous post would tell if they were installed.... but if they didn't work as user warren, I'd try to run them again as root.

Anyway, we can keep pounding on the issue to try to find what we're missing, if you want. Setting up a network share certainly should not be so hard! It would be easier just between Linux computers, or just between Windows computers... but mixing them up is different, unfortunately.

There may be many other options, but another thread on here reminded me about "remote desktop sharing" programs. A program called TeamViewer can be installed on both Windows and Linux, and you can configure it to actually take full control of the other computer, complete with the graphical desktop of the remote machine. It's easy and fast.... but the thing to be very careful about is leaving the remote computer (Debian, in your case) open to an incoming connection at will. Usually I use this program between my home Linux computer and my cousin's Windows computer in another state. TeamViewer is free for personal use. I covered a few other options above in post #9 too.

Cheers
 

Staff online


Top