How do I set up file sharing between two Ubuntu laptops on my wireless network?

118,357

Solution 1

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:

sudo apt install openssh-server

On the client you should have ssh installed already (if for some reason it's not install, run sudo 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>

Ubuntu 16 Connect to Server dialog

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.

Solution 2

If you do not require encryption you can use python. If you have installed python you can try SimpleHTTPServer. For this

cd /folder/to/share

And then,

python -m SimpleHTTPServer

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

python3 -m http.server

Solution 3

A Quick Way to Share Folders in Ubuntu

Objectives:

Share a folder between 2 Ubuntu using samba PC's

enter image description here

enter image description here

enter image description here

enter image description here

sudo smbpasswd -a USERNAME

Solution 4

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:

sudo apt install openssh-server

Get your local ip address of system which has files you want to access

ip address show

enter image description here

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 image description here

Enter

sftp://<the_IP_of_the_server>/home/<username>

and press connect, you will be asked username and password of the user of which files you want to access

Solution 5

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:

[Alpha]
    path = /media/alpha/
    browseable = yes 
    readonly = no
    guest ok = yes 
    create mask = 0644
    directory mask = 0755
    force user = default
    force group = default

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.

Share:
118,357

Related videos on Youtube

deshmukh
Author by

deshmukh

Updated on September 18, 2022

Comments

  • deshmukh
    deshmukh almost 2 years

    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?

  • Brōtsyorfuzthrāx
    Brōtsyorfuzthrāx over 7 years
    Is that Nautilus?
  • gone
    gone about 7 years
    Doesn't work...
  • Nasik Shafeek
    Nasik Shafeek over 5 years
    If this doesn't work, you can follow the following answer after doing the above, which works. askubuntu.com/a/478224/389479 Things to do with configuration.
  • tatsu
    tatsu over 5 years
    @Antinous dunno what you're talking about, plus on ubuntu 18/19 you don't even have the restart session part. you also have to choose a short name without numbers or special characters and then click "create share", once you've done that open up a terminal and type sudo smbpasswd -a tatsu where you replace "tatsu" with the session username you'll want from the other machines, it'll first ask you for your real password, then you create a filesharing password (if you want a lot of people accessing this folder, make it an easy password). then you go to the other ubuntu, go to a file explorer
  • tatsu
    tatsu over 5 years
    -> "+ other locations" click on the name you created then click on it's folder you're sharing, this will open up a samba connection, don't leave it as anonymous, select or type the username you created and also use the password you created, you can select "remember forever" and whamo! you've got a seamless browsable editable remote folder in gui.
  • petobens
    petobens about 5 years
    Thanks for the tip. To connect using the GUI on newer Ubuntu versions and with the Files program, one should click on "Other Locations -> `Connect to Server". The first one appears as the last-item on the left-menu and the second one at the bottom of the screen.
  • emagar
    emagar over 4 years
    ifconfig deprecated in 18.04. Use ip address show instead
  • Harsha
    Harsha over 4 years
    You didn't mention how I access this folder from the other computer
  • Harsha
    Harsha over 4 years
    SimpleHTTPServer doesn't seem to work on python 3. Correct me if I'm wrong.. Also, the usual Connect to server option in Nautilus doesn't seem to accept this command
  • Anonymous Platypus
    Anonymous Platypus over 4 years
    @Harsha I have edited the answer to add python3 command.
  • Harsha
    Harsha over 4 years
    So now how do we access this from the Nautilus Connect to Server option?
  • Admin
    Admin over 2 years
    where do I get username and password (of the server)?
  • hafiz031
    hafiz031 over 2 years
    Simple, but why it is slow?