Sunday, September 4, 2016

Samba Setup or Python Share


2018-08-14 Edit:
For what it's worth - Use Manjaro and save yourself some headaches.
(The http server only makes files on linux available and does on receive files)
Python file server in VirtualBox
Manjaro has Python 3
Create a Share folder and add a test file.
Within the Share folder open Terminal and enter the following
python -m http.server
This starts the server
Terminal must stay open while the server is running.
To stop the server, enter Cntl-c
Open a second Terminal and find the IP of machine

ip addr
It should look like this.
The IP here is 192.168.1.38 and the default port is 8000
To get this, the machine's network adapter needs to be set as "bridged" instead of NAT
Now on the Windows host and through the browser you can access the Linux Share server through the IP 192.168.1.38:8000
Using a Debian system with Python 2 the command is python -m SimpleHTTPServer
I Debian has Python 3 then python3 -m http:server works

This is primitive but you can get files from the Linux machine and onto the Windows machine without a Samba setup.


On the other hand if you are running Manjaro, Samba setup is simple
XFCE Desktop do this
sudo pacman -S samba gvfs-smb thunar-shares-plugin
Then this
sudo pacman -S manjaro-settings-samba
Networking should now work.
So far I can only access Windows from Manjaro but not see Manjaro from Windows.
But I can move file both ways.

Here is the documentation
https://wiki.manjaro.org/index.php?title=Using_Samba_in_your_File_Manager

Below are some previous notes on Samba
After all the fooling around this works both ways Win - Linux share.
Some of the lines in smb.conf may not be needed. I hope to set up again with default smb.conf altered and see results. I think my problem was stuff before smb.conf and permissions of 0755. I may have omitted sudo on some syntax the requires it. This is drop dead simple.

Install Samba
mkdir /home/george/share
cd /home/george/share
touch testfile
ls
sudo smbpasswd -a george
sudo groupadd smbusers
sudo chown :smbusers /home/george/Share (case sensitive)
sudo usermod -G smbusers george

cd /etc/samba
ls
cp smb.conf smb.conf.orig
sudo nano smb.conf                        
This works both ways win & linux
[global]
server string = Manjaro
workgroup = WORKGROUP
security = user
map to guest = Bad User (not sure this is necessary)
name resolve order = bcast hosts wins

[Share]
        comment = linux share
        force user = george
        browseable = yes
        path = /home/george/Share
        guest ok = yes
        read only = no
        create mask = 0755

sudo systemctl restart smbd.service
sudo systemctl restart nmbd.service

Best Instruction Here
https://www.youtube.com/watch?v=CnYTRFTkhNo

If you want a faster server setup (But Samba is easy enough)
Quick Manjaro share with Windows, phone, tablet
On PC to shareopen a terminal in the folder you wish to share.
python -m http.server
To determine ip type ip addr

On PC wanting access
http://the IP of the sharing computer:8000

Sharing from other systems with your Manjaro computer with Python2
python -m SimpleHTTPServer
python -m http.server 9000 (or 8000 etc.)
Will work as long as terminal open
Stop with
CTRL+c

Creating a permanent file server
pacman -S python2-twisted
twistd web --path . --port 8000
If you are comfortable with using the default port 8080 It will be enough to simply type:
twistd web
To stop this server you can type:
kill `cat twistd.pid`

Instructions here:
https://wiki.manjaro.org/index.php?title=Sharing_files_in_a_Network_-_the_easy_way

Of course none of this works in Mint now. You can't even restart smbd with the old commands. What crazy crap. Trust me. Linux will never remain consistently usable for normal humans.


Curl, Wget, Winget & Powershell Install or Download Commands

After the mess I made in previous posts this summary might be useful.     Thanks PatchMyPC, the great and powerful program downloader and up...