854
edits
m (added languages and translate tags) |
(Marked this version for translation) |
||
Line 2: | Line 2: | ||
__TOC__ | __TOC__ | ||
<translate> | <translate> | ||
==Introduction== | ==Introduction== <!--T:1--> | ||
There are many ways to share files in a network. Samba is commonly used for interop sharing. These methods will be easier and faster to set up. | There are many ways to share files in a network. Samba is commonly used for interop sharing. These methods will be easier and faster to set up. | ||
They can be used to share files between your computer your Smartphone or Tab/Pad. | They can be used to share files between your computer your Smartphone or Tab/Pad. | ||
<!--T:2--> | |||
You can share with: | You can share with: | ||
<!--T:3--> | |||
* OSX | * OSX | ||
* Windows | * Windows | ||
* Android | * Android | ||
<!--T:4--> | |||
it will work on all platforms. | it will work on all platforms. | ||
<!--T:5--> | |||
This is for the situation that you need to share something fast and is not advisable as part of your regular infrastructure. | This is for the situation that you need to share something fast and is not advisable as part of your regular infrastructure. | ||
===Installing=== | ===Installing=== <!--T:6--> | ||
That is the beauty of it - there is nothing to install. This method will work right out of the box because Manjaro comes with Python 3 which makes it easy to share files rapidly in your network. | That is the beauty of it - there is nothing to install. This method will work right out of the box because Manjaro comes with Python 3 which makes it easy to share files rapidly in your network. | ||
===Using it=== | ===Using it=== <!--T:7--> | ||
<!--T:8--> | |||
Open a terminal on the computer that contains the files you want to share and navigate to the directory where the files you want to share are like ˝/home; then type: | Open a terminal on the computer that contains the files you want to share and navigate to the directory where the files you want to share are like ˝/home; then type: | ||
python -m http.server | <!--T:9--> | ||
python -m http.server | |||
<!--T:10--> | |||
Now go to the computer, phone or tab that should receive the files and open a browser.[[File:sharing.jpg|thumb|right|375px]] | Now go to the computer, phone or tab that should receive the files and open a browser.[[File:sharing.jpg|thumb|right|375px]] | ||
In the url field of the browser you type | In the url field of the browser you type | ||
<nowiki>http://the_IP_of_the_sharing_computer:8000</nowiki> | <!--T:11--> | ||
<nowiki>http://the_IP_of_the_sharing_computer:8000</nowiki> | |||
<!--T:12--> | |||
To find the IP of the computer you want to share from you type: | To find the IP of the computer you want to share from you type: | ||
ip addr | ip addr | ||
<!--T:13--> | |||
Something like this: | Something like this: | ||
<nowiki>http://192.168.0.123:8000</nowiki> | <!--T:14--> | ||
<nowiki>http://192.168.0.123:8000</nowiki> | |||
<!--T:15--> | |||
This will list all the files in the directory of the sharing computer.: | This will list all the files in the directory of the sharing computer.: | ||
<!--T:16--> | |||
Now you can download or open the files. - It is as easy as that. | Now you can download or open the files. - It is as easy as that. | ||
===Sharing from other systems with your Manjaro computer=== | ===Sharing from other systems with your Manjaro computer=== <!--T:17--> | ||
<!--T:18--> | |||
Since you might want to share files from other computers with your Manjaro computer; they may have Python2 | Since you might want to share files from other computers with your Manjaro computer; they may have Python2 | ||
(This is the case for Debian,, Mageia and several other distros. In Windows you need to install Python first) | (This is the case for Debian,, Mageia and several other distros. In Windows you need to install Python first) | ||
<!--T:19--> | |||
Here you have to write a different command. | Here you have to write a different command. | ||
Open a terminal and write: | Open a terminal and write: | ||
python -m SimpleHTTPServer | <!--T:20--> | ||
python -m SimpleHTTPServer | |||
<!--T:21--> | |||
Go to your Manjaro computer and open the url as described above and you will have access to the files. | Go to your Manjaro computer and open the url as described above and you will have access to the files. | ||
<!--T:22--> | |||
If you want to use another port than the default 8000 - say 9000 - you can enter it like this: | If you want to use another port than the default 8000 - say 9000 - you can enter it like this: | ||
python -m http.server 9000 | <!--T:23--> | ||
python -m http.server 9000 | |||
===stopping the server=== | ===stopping the server=== <!--T:24--> | ||
Once you have shared the files; just stop the server with | Once you have shared the files; just stop the server with | ||
CTRL+c | <!--T:25--> | ||
CTRL+c | |||
<!--T:26--> | |||
It is as easy as that! | It is as easy as that! | ||
===Some final remarks=== | ===Some final remarks=== <!--T:27--> | ||
This server will live in your terminal and occupy it until you cancel it. You can see every transaction. | This server will live in your terminal and occupy it until you cancel it. You can see every transaction. | ||
You can only share with one computer at the time. | You can only share with one computer at the time. | ||
It is a fast and super easy solution for that. {{note|This is not a permanent file server.}} | It is a fast and super easy solution for that. {{note|This is not a permanent file server.}} | ||
==Creating a permanent file server (still the easy way)== | ==Creating a permanent file server (still the easy way)== <!--T:28--> | ||
You would not want to use the sharing solution above (permanently) on an internet connected machine. | You would not want to use the sharing solution above (permanently) on an internet connected machine. | ||
It will share your files quick and easy to one person. If 10 persons try to access the files at the same time it will not work - it is a one at the time solution. | It will share your files quick and easy to one person. If 10 persons try to access the files at the same time it will not work - it is a one at the time solution. | ||
Line 80: | Line 101: | ||
Install python-twisted and python-service-identity (they are in the extra repo). | Install python-twisted and python-service-identity (they are in the extra repo). | ||
sudo pacman -S python-twisted python-service-identity | <!--T:29--> | ||
sudo pacman -S python-twisted python-service-identity | |||
===Using it=== | ===Using it=== <!--T:30--> | ||
To make a permanent server on port 8080 with python; you can go to the directory you want to share and type: | To make a permanent server on port 8080 with python; you can go to the directory you want to share and type: | ||
twistd3 web --path . | <!--T:31--> | ||
twistd3 web --path . | |||
[[File:Twisted.jpg|thumb|left|375px]] | [[File:Twisted.jpg|thumb|left|375px]] | ||
twistd web will then start and you can access in the browser with: | twistd web will then start and you can access in the browser with: | ||
http://localhost:8080/ | <!--T:32--> | ||
http://localhost:8080/ | |||
<!--T:33--> | |||
It looks a bit better and your terminal will not be occupied with "live action". Here all people can access the files at the same time. | It looks a bit better and your terminal will not be occupied with "live action". Here all people can access the files at the same time. | ||
<!--T:34--> | |||
If you need to set the server to a different port then you can start the server like this: | If you need to set the server to a different port then you can start the server like this: | ||
twistd3 web --port "tcp:port=9000" --path . | <!--T:35--> | ||
twistd3 web --port "tcp:port=9000" --path . | |||
<!--T:36--> | |||
In this case the server will be on port 9000. | In this case the server will be on port 9000. | ||
Line 102: | Line 130: | ||
<!--T:37--> | |||
Python is often updated so if you get any errors running the command above you can alternatively try: | Python is often updated so if you get any errors running the command above you can alternatively try: | ||
python -c 'from twisted.web.server import Site; from twisted.web.static import File; from twisted.internet import reactor; reactor.listenTCP(8000, Site(File("."))); reactor.run()' | python -c 'from twisted.web.server import Site; from twisted.web.static import File; from twisted.internet import reactor; reactor.listenTCP(8000, Site(File("."))); reactor.run()' | ||
break it off with '''CTRL+Z''' and then type '''bg''' to start it in the background. | break it off with '''CTRL+Z''' and then type '''bg''' to start it in the background. | ||
<!--T:38--> | |||
Here the server will be on port 8000 you can change it to your liking. | Here the server will be on port 8000 you can change it to your liking. | ||
===Stopping the server=== | ===Stopping the server=== <!--T:39--> | ||
<!--T:40--> | |||
To stop this server you can type: | To stop this server you can type: | ||
kill `cat twistd.pid` | kill `cat twistd.pid` | ||
<!--T:41--> | |||
Now you have a permanent file server. | Now you have a permanent file server. | ||
{{note|If you want to share from other servers to (not from) Manjaro then you may need to install '''python2-twisted''' and start the server with '''twistd web --path .''' systems}} | {{note|If you want to share from other servers to (not from) Manjaro then you may need to install '''python2-twisted''' and start the server with '''twistd web --path .''' systems}} |