I have two laptops running Ubuntu 12.04. Both connect to the same WIFI network to access internet.
How do I connect them to each other so that I can access files on one from another and vice versa?
Also, how do I manage the user permissions, etc. on them?
Share files between 2 Ubuntu computers
If you have two computers running Ubuntu on the same network, it would be an good idea to use openssh to share files between them.
On the server (the computer with the files you want to access), run:
On the client you should have
ssh
installed already (if for some reason it's not install, runsudo apt install openssh-client
).Then you need to figure out the IP of the computer you want to connect to. Most of the time it's something like 192.168.1.x. To find out the IP, run
ifconfig
and look for the "wl..." interface (or "eth..." if you're connected over Ethernet cable).On the client, open Nautilus (Super+E) and go to “File -> Connect to Server”.
Enter
sftp://<the_IP_of_the_server>
On older version of Ubuntu, you could pick the folder you wish to share. As of Ubuntu 16, if you don't specify a path after the IP, you'll get the home directory. For a specific directory outside of the home dir of the user you're connecting as, you need to type its path.
Note that it could take some time to connect, depending on the size of the folder directory.
You'll be prompted for the user/password of the computer you want to connect to.
The name of the directory will become a bookmark in Nautilus.
You should have read/write permissions.
If you do not require encryption you can use python. If you have installed python you can try SimpleHTTPServer. For this
And then,
This will allow sharing through port 8000. The other machine can access the files using http://yourlocalIP:8000
EDIT
Since python2 is stopped support, here is the command to python3
A Quick Way to Share Folders in Ubuntu
It seems like every installation of samba is a bit different. You'll want to tweak around with the settings until you get something that works.
Perhaps this will help though. This is my mount of an ntfs drive:
Then I made sure that /media/alpha was mounted with 777 permissions.
Using Samba does this to you... sshfs is better.
Edit: I've recently updated the permissions on my External Drive, and having it mounted as 777 isn't required. Limiting permissions on an ntfs drive is probably another topic.
You can achive this securely via SSH, you need to install openssh-server on the host machine from which you want to access the files use following command to install:
Get your local ip address of system which has files you want to access
if connected to wifi pick 3: wl01 or in case of Ethernet pick 2: enp3s0
you are done with host, move to the system form which you want to access, open file manager (nautilus) and chose Other Locations at the bottom notice connect to Server input box
Enter
and press connect, you will be asked username and password of the user of which files you want to access
go to /etc/samba directory and type:
Then just add this line after workgroup name:
and exit with saving.
Now restart the services:
Now create a samba user:
and provide password for that user.
That's it!!!